Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implement profile settings feature #808

Merged
merged 26 commits into from
Feb 1, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
7ed8cad
feat: add profile update api function
OgDev-01 Jan 27, 2023
5649bde
refactor: minor updates
OgDev-01 Jan 27, 2023
d1f7b7b
feat: add settings na d profile route
OgDev-01 Jan 27, 2023
69764d0
feat: add toast support and validation
OgDev-01 Jan 28, 2023
991bc88
chore: minor api call fixes
OgDev-01 Jan 28, 2023
8f063a5
refactor: remove unwanted code
OgDev-01 Jan 28, 2023
b9a22c2
refactor: update default values
OgDev-01 Jan 30, 2023
d96d29c
refactor: add timezone array to select options
OgDev-01 Jan 30, 2023
8d08219
refactor: add cursor indication for disabled input
OgDev-01 Jan 30, 2023
6497233
feat: create useAuthSession hook for user data
OgDev-01 Jan 30, 2023
8d8d1c7
chore: guard settings page
OgDev-01 Jan 30, 2023
cb058d9
refactor: update input placeholders
OgDev-01 Jan 30, 2023
90488f6
fix: build and language chart issues
OgDev-01 Jan 30, 2023
902e423
refactor: cleanups and finishing touches
OgDev-01 Jan 31, 2023
efd0173
chore: remove unused code
OgDev-01 Jan 31, 2023
9b3ea6c
refactor: update user profile link icon
OgDev-01 Jan 31, 2023
613d258
Update components/organisms/UserSettingsPage/user-settings-page.tsx
OgDev-01 Jan 31, 2023
eedfa5b
Update components/organisms/UserSettingsPage/user-settings-page.tsx
OgDev-01 Jan 31, 2023
af167fa
Update components/organisms/UserSettingsPage/user-settings-page.tsx
OgDev-01 Jan 31, 2023
fd33ab3
chore: update Db user type
OgDev-01 Jan 31, 2023
22b1492
feat: implement update user email preference
OgDev-01 Jan 31, 2023
0bacf82
Merge branch '794-implement-profile-settings' of https://github.com/o…
OgDev-01 Jan 31, 2023
92a1a23
refactor: cleanup anf fininshing touches
OgDev-01 Jan 31, 2023
56c1607
chore: general refactor and cleanup
OgDev-01 Jan 31, 2023
92f13b2
chore: update api call response
OgDev-01 Jan 31, 2023
f240786
fix: build error
OgDev-01 Jan 31, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion components/atoms/Avatar/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const Avatar = (props: AvatarProps): JSX.Element => {
case "string":
return <DefaultAvatar {...props} avatarURL={imageSource} />;
case "number":
return <CustomAvatar {...props} />;
return <CustomAvatar {...props} avatarURL={imageSource} />;

default:
return <span>invalid avatar size props!!!</span>;
Expand Down
24 changes: 14 additions & 10 deletions components/atoms/TextInput/text-input.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ const TextInput = ({
"flex-1 px-3 text-light-slate-12 bg-white shadow-input border transition rounded-lg py-1 flex items-center",
borderless && "!border-none",
state === "invalid" ? " focus-within:border-light-red-10 " : "focus-within:border-light-orange-9 ",
disabled && "bg-light-slate-3",
disabled && "bg-light-slate-3 text-light-slate-6",
classNames
)}
>
Expand All @@ -57,18 +57,22 @@ const TextInput = ({
placeholder={placeholder || ""}
onChange={onChange}
value={value}
className={`flex-1 focus:outline-none ${classNames}`}
className={`flex-1 focus:outline-none ${classNames} ${disabled && "bg-light-slate-3 text-light-slate-9"}`}
autoFocus={autoFocus}
disabled={disabled}
/>
{state === "valid" ? (
<CheckCircleFillIcon className="text-light-orange-9" size={14} />
) : !!value ? (
<span className="flex items-center" onClick={() => handleResetInput()}>
<XCircleFillIcon className="text-light-red-11" size={14} />
</span>
) : (
""
{!disabled && (
<>
{state === "valid" ? (
<CheckCircleFillIcon className="text-light-orange-9" size={14} />
) : !!value ? (
<span className="flex items-center" onClick={() => handleResetInput()}>
<XCircleFillIcon className="text-light-red-11" size={14} />
</span>
) : (
""
)}
</>
)}
</div>
</label>
Expand Down
26 changes: 25 additions & 1 deletion components/molecules/AuthSection/auth-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,41 @@ import DropdownList from "../DropdownList/dropdown-list";
import Text from "components/atoms/Typography/text";
import { Divider } from "@supabase/ui";
import useSupabaseAuth from "../../../lib/hooks/useSupabaseAuth";
import { FiLogOut } from "react-icons/fi";
import { FiLogOut, FiSettings } from "react-icons/fi";
import GitHubIcon from "img/icons/github-icon.svg";
import Icon from "components/atoms/Icon/icon";
import useSession from "lib/hooks/useSession";
import Link from "next/link";

const AuthSection: React.FC = ({}) => {
const { signIn, signOut, user } = useSupabaseAuth();
const { onboarded } = useSession();

const authMenu = {
authed: [
<Link
href={`/user/${user?.user_metadata.user_name}`}
key="settings"
className="group flex gap-x-3 text-lg hover:bg-light-orange-3 items-center px-4 py-2 rounded-md cursor-pointer transition"
>
<Avatar
alt="User Avatar"
avatarURL={user ? user.user_metadata.avatar_url : userAvatar}
size={18}
hasBorder={true}
isCached={false}
isCircle
/>
<Text className="group-hover:text-light-orange-10">{user?.user_metadata.user_name}</Text>
</Link>,
<Link
href="/user/settings"
key="settings"
className="group flex gap-x-3 text-lg hover:bg-light-orange-3 items-center px-4 py-2 rounded-md cursor-pointer transition"
>
<FiSettings className="group-hover:text-light-orange-10" />
<Text className="group-hover:text-light-orange-10">Settings</Text>
</Link>,
<span
onClick={async () => await signOut()}
key="authorized"
Expand Down
Loading