diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/AccountSettings.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/AccountSettings.tsx index 51eb653d..f260339d 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/AccountSettings.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/AccountSettings.tsx @@ -1,5 +1,5 @@ 'use client'; -import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; +import { Card, CardDescription, CardFooter, CardHeader, CardTitle } from '@/components/ui/card'; import { UpdateAvatarAndNameBody } from '@/components/UpdateAvatarAndName'; import { updateUserProfileNameAndAvatar, @@ -95,30 +95,29 @@ export function AccountSettings({ return (
Account Settings Update your account settings here. - - mutate({ fullName, avatarUrl })} - onFileUpload={(file: File) => upload(file)} - userId={userProfile.id} - userEmail={userEmail} - isNewAvatarImageLoading={isNewAvatarImageLoading} - setIsNewAvatarImageLoading={setIsNewAvatarImageLoading} - isUploading={isUploading} - isLoading={isLoading ?? isUploading} - profileAvatarUrl={avatarUrl} - profileFullname={userProfile.full_name ?? undefined} - /> - + mutate({ fullName, avatarUrl })} + onFileUpload={(file: File) => upload(file)} + userId={userProfile.id} + userEmail={userEmail} + profileUserName={userProfile.user_name ?? undefined} + isNewAvatarImageLoading={isNewAvatarImageLoading} + setIsNewAvatarImageLoading={setIsNewAvatarImageLoading} + isUploading={isUploading} + isLoading={isLoading ?? isUploading} + profileAvatarUrl={avatarUrl} + profileFullname={userProfile.full_name ?? undefined} + /> - + Danger Zone diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/UpdatePassword.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/UpdatePassword.tsx index c3e0fab6..3063ce20 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/UpdatePassword.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/UpdatePassword.tsx @@ -1,10 +1,10 @@ 'use client'; import { Button } from '@/components/ui/button'; +import { CardContent, CardFooter } from '@/components/ui/card'; import { Input } from '@/components/ui/input'; import { Label } from '@/components/ui/label'; import { updatePasswordAction } from '@/data/user/security'; import { useSAToastMutation } from '@/hooks/useSAToastMutation'; -import { classNames } from '@/utils/classNames'; import { useInput } from 'rooks'; export const UpdatePassword = () => { @@ -31,8 +31,8 @@ export const UpdatePassword = () => { ); return ( -
-
+ <> + @@ -42,26 +42,25 @@ export const UpdatePassword = () => { name="password" type="password" autoComplete="password" + className='w-full' required {...passwordInput} />
+ + -
-
+ + ); }; diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/page.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/page.tsx index b495485f..3d958ff6 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/page.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/(user-pages)/settings/security/page.tsx @@ -1,14 +1,11 @@ -import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; -import { Input } from '@/components/ui/input'; -import { Label } from '@/components/ui/label'; -import { T } from '@/components/ui/Typography'; +import { Card, CardDescription, CardHeader, CardTitle } from '@/components/ui/card'; import { serverGetLoggedInUser } from '@/utils/server/serverGetLoggedInUser'; import { UpdatePassword } from './UpdatePassword'; export default async function SecuritySettings() { const user = await serverGetLoggedInUser(); return ( -
+
@@ -18,29 +15,9 @@ export default async function SecuritySettings() { Update your email and password - -
- -
- -
- - Email cannot be changed - -
- -
+ + +
); diff --git a/src/app/(dynamic-pages)/(authenticated-pages)/onboarding/OrganizationCreation.tsx b/src/app/(dynamic-pages)/(authenticated-pages)/onboarding/OrganizationCreation.tsx index b33480fa..c0819482 100644 --- a/src/app/(dynamic-pages)/(authenticated-pages)/onboarding/OrganizationCreation.tsx +++ b/src/app/(dynamic-pages)/(authenticated-pages)/onboarding/OrganizationCreation.tsx @@ -63,7 +63,7 @@ export function OrganizationCreation({ onSuccess }: OrganizationCreationProps) {

{errors.organizationTitle.message}

)}
-
+ {/*
{errors.organizationSlug.message}

)} -
+
*/} - - - - -
-
- - setFullName(e.target.value)} - placeholder="Enter your user name" - disabled - className='w-full mb-2 ' - /> - - Username cannot be changed - -
-
+
+ ); } diff --git a/src/data/user/user.tsx b/src/data/user/user.tsx index aa269554..2df30b9a 100644 --- a/src/data/user/user.tsx +++ b/src/data/user/user.tsx @@ -143,9 +143,11 @@ export const uploadPublicUserAvatar = async ( export const updateUserProfileNameAndAvatar = async ( { fullName, + userName, avatarUrl, }: { fullName?: string; + userName?: string; avatarUrl?: string; }, { @@ -161,6 +163,7 @@ export const updateUserProfileNameAndAvatar = async ( .from("user_profiles") .update({ full_name: fullName, + user_name: userName, avatar_url: avatarUrl, }) .eq("id", user.id) diff --git a/src/lib/database.types.ts b/src/lib/database.types.ts index ba8bb400..7e6b1418 100644 --- a/src/lib/database.types.ts +++ b/src/lib/database.types.ts @@ -1665,18 +1665,21 @@ export type Database = { created_at: string full_name: string | null id: string + user_name: string | null } Insert: { avatar_url?: string | null created_at?: string full_name?: string | null id: string + user_name?: string | null } Update: { avatar_url?: string | null created_at?: string full_name?: string | null id?: string + user_name?: string | null } Relationships: [ { diff --git a/supabase/migrations/20240807133856_add_user_name_to_profile.sql b/supabase/migrations/20240807133856_add_user_name_to_profile.sql new file mode 100644 index 00000000..eb4b0135 --- /dev/null +++ b/supabase/migrations/20240807133856_add_user_name_to_profile.sql @@ -0,0 +1,2 @@ +ALTER TABLE "public"."user_profiles" +ADD COLUMN "user_name" character varying NULL; \ No newline at end of file