Skip to content

Commit

Permalink
chore: profile cover photo (#1836)
Browse files Browse the repository at this point in the history
  • Loading branch information
anmolsinghbhatia committed Aug 11, 2023
1 parent dbb53a6 commit e2b5657
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 2 additions & 2 deletions apps/app/components/core/image-picker-popover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ const unsplashEnabled =

const tabOptions = [
{
key: "unsplash",
title: "Unsplash",
key: "images",
title: "Images",
},
{
key: "upload",
Expand Down
38 changes: 37 additions & 1 deletion apps/app/pages/[workspaceSlug]/me/profile/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import useToast from "hooks/use-toast";
import { WorkspaceAuthorizationLayout } from "layouts/auth-layout";
import SettingsNavbar from "layouts/settings-navbar";
// components
import { ImageUploadModal } from "components/core";
import { ImagePickerPopover, ImageUploadModal } from "components/core";
// ui
import { CustomSelect, DangerButton, Input, SecondaryButton, Spinner } from "components/ui";
import { BreadcrumbItem, Breadcrumbs } from "components/breadcrumbs";
Expand All @@ -26,6 +26,7 @@ import { USER_ROLES } from "constants/workspace";

const defaultValues: Partial<IUser> = {
avatar: "",
cover_image: "",
first_name: "",
last_name: "",
email: "",
Expand Down Expand Up @@ -68,6 +69,7 @@ const Profile: NextPage = () => {
first_name: formData.first_name,
last_name: formData.last_name,
avatar: formData.avatar,
cover_image: formData.cover_image,
role: formData.role,
display_name: formData.display_name,
};
Expand Down Expand Up @@ -202,6 +204,40 @@ const Profile: NextPage = () => {
</div>
</div>
</div>
<div className="grid grid-cols-12 gap-4 sm:gap-16">
<div className="col-span-12 sm:col-span-6">
<h4 className="text-lg font-semibold">Cover Photo</h4>
<p className="text-sm text-custom-text-200">
Select your cover photo from the given library.
</p>
</div>
<div className="col-span-12 sm:col-span-6">
<div className="h-32 w-full rounded border border-custom-border-200 p-1">
<div className="relative h-full w-full rounded">
<img
src={
watch("cover_image") ??
"https://images.unsplash.com/photo-1506383796573-caf02b4a79ab"
}
className="absolute top-0 left-0 h-full w-full object-cover rounded"
alt={myProfile?.name ?? "Cover image"}
/>
<div className="absolute bottom-0 flex w-full justify-end">
<ImagePickerPopover
label={"Change cover"}
onChange={(imageUrl) => {
setValue("cover_image", imageUrl);
}}
value={
watch("cover_image") ??
"https://images.unsplash.com/photo-1506383796573-caf02b4a79ab"
}
/>
</div>
</div>
</div>
</div>
</div>
<div className="grid grid-cols-12 gap-4 sm:gap-16">
<div className="col-span-12 sm:col-span-6">
<h4 className="text-lg font-semibold text-custom-text-100">Full Name</h4>
Expand Down
1 change: 1 addition & 0 deletions apps/app/types/users.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {

export interface IUser {
avatar: string;
cover_image: string | null;
created_at: readonly Date;
created_location: readonly string;
date_joined: readonly Date;
Expand Down

0 comments on commit e2b5657

Please sign in to comment.