tr]:last:border-b-0",
- className
+ 'border-t bg-muted/50 font-medium [&>tr]:last:border-b-0',
+ className,
)}
{...props}
/>
-))
-TableFooter.displayName = "TableFooter"
+));
+TableFooter.displayName = 'TableFooter';
const TableRow = React.forwardRef<
HTMLTableRowElement,
@@ -58,13 +58,13 @@ const TableRow = React.forwardRef<
-))
-TableRow.displayName = "TableRow"
+));
+TableRow.displayName = 'TableRow';
const TableHead = React.forwardRef<
HTMLTableCellElement,
@@ -73,13 +73,13 @@ const TableHead = React.forwardRef<
[role=checkbox]]:translate-y-[2px]",
- className
+ 'h-10 px-2 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
+ className,
)}
{...props}
/>
-))
-TableHead.displayName = "TableHead"
+));
+TableHead.displayName = 'TableHead';
const TableCell = React.forwardRef<
HTMLTableCellElement,
@@ -88,13 +88,13 @@ const TableCell = React.forwardRef<
| [role=checkbox]]:translate-y-[2px]",
- className
+ 'p-2 align-middle [&:has([role=checkbox])]:pr-0 [&>[role=checkbox]]:translate-y-[2px]',
+ className,
)}
{...props}
/>
-))
-TableCell.displayName = "TableCell"
+));
+TableCell.displayName = 'TableCell';
const TableCaption = React.forwardRef<
HTMLTableCaptionElement,
@@ -102,11 +102,11 @@ const TableCaption = React.forwardRef<
>(({ className, ...props }, ref) => (
-))
-TableCaption.displayName = "TableCaption"
+));
+TableCaption.displayName = 'TableCaption';
export {
Table,
@@ -117,4 +117,4 @@ export {
TableRow,
TableCell,
TableCaption,
-}
+};
diff --git a/src/server/actions/auth.ts b/src/server/actions/auth.ts
index cb76438..8aa5794 100644
--- a/src/server/actions/auth.ts
+++ b/src/server/actions/auth.ts
@@ -23,7 +23,7 @@ export const login = async (formData: FormData) => {
}
revalidatePath('/', 'layout');
- redirect('/');
+ redirect('/?refresh=true');
};
export const signup = async (formData: FormData) => {
@@ -44,5 +44,5 @@ export const signup = async (formData: FormData) => {
}
revalidatePath('/', 'layout');
- redirect('/');
+ redirect('/?refresh=true');
};
diff --git a/src/server/actions/image.ts b/src/server/actions/image.ts
new file mode 100644
index 0000000..3dd3d77
--- /dev/null
+++ b/src/server/actions/image.ts
@@ -0,0 +1,47 @@
+'use server';
+import 'server-only';
+import { createClient } from '@/utils/supabase/server';
+
+export const getImageUrl = async (
+ bucket: string,
+ path: string,
+): Promise => {
+ try {
+ const supabase = await createClient();
+
+ // Download the image as a blob
+ const { data, error } = await supabase.storage.from(bucket).download(path);
+
+ if (error) {
+ console.error('Error downloading image:', error);
+ throw new Error(`Failed to download image: ${error.message}`);
+ }
+
+ if (!data) {
+ throw new Error('No data received from storage');
+ }
+
+ // Convert blob to base64 string on the server
+ const arrayBuffer = await data.arrayBuffer();
+ const buffer = Buffer.from(arrayBuffer);
+ const base64 = buffer.toString('base64');
+
+ // Determine MIME type from file extension or default to octet-stream
+ let mimeType = 'application/octet-stream';
+ if (path.endsWith('.png')) mimeType = 'image/png';
+ else if (path.endsWith('.jpg') || path.endsWith('.jpeg'))
+ mimeType = 'image/jpeg';
+ else if (path.endsWith('.gif')) mimeType = 'image/gif';
+ else if (path.endsWith('.svg')) mimeType = 'image/svg+xml';
+ else if (path.endsWith('.webp')) mimeType = 'image/webp';
+
+ // Return as data URL
+ return `data:${mimeType};base64,${base64}`;
+ } catch (error) {
+ console.error(
+ 'Error processing image:',
+ error instanceof Error ? error.message : String(error),
+ );
+ throw new Error('Failed to process image');
+ }
+};
diff --git a/src/server/actions/status.ts b/src/server/actions/status.ts
index 7c581e1..49e9a1c 100644
--- a/src/server/actions/status.ts
+++ b/src/server/actions/status.ts
@@ -12,5 +12,5 @@ export const fetchHistory = async ({
currentPage = 1,
user = null,
}: fetchHistoryProps): PaginatedHistory => {
- const supabase = createClient();
+ const supabase = createClient();
};
|