Update Supabase dependency, delete cookie handling, create logger
Updated Supabase dependency across multiple packages from "^2.41.1" to "^2.42.0". Removed files handling sidebar state and theme cookies. Created a new Logger interface for managing log messages in the shared package. Enhanced the middleware to track accounts membership webhook payload. Minor adjustments were also made in multiple package.json files.
This commit is contained in:
@@ -7,6 +7,7 @@ import type { SupabaseClient } from '@supabase/supabase-js';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { toast } from 'sonner';
|
||||
|
||||
import { Database } from '@kit/supabase/database';
|
||||
import { useSupabase } from '@kit/supabase/hooks/use-supabase';
|
||||
import { ImageUploader } from '@kit/ui/image-uploader';
|
||||
import { LoadingOverlay } from '@kit/ui/loading-overlay';
|
||||
@@ -123,7 +124,7 @@ function UploadProfileAvatarForm(props: {
|
||||
);
|
||||
}
|
||||
|
||||
function deleteProfilePhoto(client: SupabaseClient, url: string) {
|
||||
function deleteProfilePhoto(client: SupabaseClient<Database>, url: string) {
|
||||
const bucket = client.storage.from(AVATARS_BUCKET);
|
||||
const fileName = url.split('/').pop()?.split('?')[0];
|
||||
|
||||
@@ -135,7 +136,7 @@ function deleteProfilePhoto(client: SupabaseClient, url: string) {
|
||||
}
|
||||
|
||||
async function uploadUserProfilePhoto(
|
||||
client: SupabaseClient,
|
||||
client: SupabaseClient<Database>,
|
||||
photoFile: File,
|
||||
userId: string,
|
||||
) {
|
||||
@@ -158,6 +159,9 @@ async function getAvatarFileName(
|
||||
extension: string | undefined,
|
||||
) {
|
||||
const { nanoid } = await import('nanoid');
|
||||
|
||||
// we add a version to the URL to ensure
|
||||
// the browser always fetches the latest image
|
||||
const uniqueId = nanoid(16);
|
||||
|
||||
return `${userId}.${extension}?v=${uniqueId}`;
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
"@kit/tailwind-config": "workspace:*",
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@kit/ui": "workspace:^",
|
||||
"@supabase/supabase-js": "^2.41.1",
|
||||
"@supabase/supabase-js": "^2.42.0",
|
||||
"lucide-react": "^0.363.0"
|
||||
},
|
||||
"exports": {
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
"@kit/tailwind-config": "workspace:*",
|
||||
"@kit/tsconfig": "workspace:*",
|
||||
"@kit/ui": "workspace:^",
|
||||
"@supabase/supabase-js": "^2.42.0",
|
||||
"@tanstack/react-query": "5.28.6",
|
||||
"lucide-react": "^0.363.0",
|
||||
"react-i18next": "^14.1.0"
|
||||
@@ -36,6 +37,7 @@
|
||||
"@kit/shared": "0.1.0",
|
||||
"@kit/supabase": "0.1.0",
|
||||
"@kit/ui": "0.1.0",
|
||||
"@supabase/supabase-js": "^2.42.0",
|
||||
"lucide-react": "^0.363.0"
|
||||
},
|
||||
"prettier": "@kit/prettier-config",
|
||||
|
||||
@@ -53,12 +53,15 @@ export function TeamAccountDangerZone({
|
||||
return <LoadingOverlay fullPage={false} />;
|
||||
}
|
||||
|
||||
// Only the primary owner can delete the team account
|
||||
const userIsPrimaryOwner = user?.id === primaryOwnerUserId;
|
||||
|
||||
if (userIsPrimaryOwner) {
|
||||
return <LeaveTeamContainer account={account} />;
|
||||
return <DeleteTeamContainer account={account} />;
|
||||
}
|
||||
|
||||
// A primary owner can't leave the team account
|
||||
// but other members can
|
||||
return <LeaveTeamContainer account={account} />;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user