feat: update ui

Signed-off-by: Adithya Krishna <adithya@documenso.com>
This commit is contained in:
Adithya Krishna
2024-02-24 22:38:53 +05:30
committed by Mythie
parent b1261510d2
commit b498f8edb7
22 changed files with 442 additions and 237 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 104 KiB

View File

@ -1,14 +0,0 @@
import { prisma } from '@documenso/prisma';
import type { UserProfile } from '@documenso/prisma/client';
export interface GetPublicProfileByURLOptions {
profileURL: UserProfile['profileURL'];
}
export const getPublicProfileByURL = async ({ profileURL }: GetPublicProfileByURLOptions) => {
return await prisma.userProfile.findFirstOrThrow({
where: {
profileURL: profileURL,
},
});
};

View File

@ -5,27 +5,30 @@ import { getUserById } from './get-user-by-id';
export type UpdatePublicProfileOptions = {
id: User['id'];
userProfile: UserProfile;
profileURL: UserProfile['profileURL'];
};
export const updatePublicProfile = async ({ id, userProfile }: UpdatePublicProfileOptions) => {
export const updatePublicProfile = async ({ id, profileURL }: UpdatePublicProfileOptions) => {
const user = await getUserById({ id });
console.log('Adi', user);
// Existence check
await prisma.userProfile.findFirstOrThrow({
where: {
profileURL: user.profileURL ?? '',
profileURL: user.profileURL ?? undefined,
},
});
return await prisma.$transaction(async (tx) => {
await tx.userProfile.create({
data: {
profileURL,
},
});
await tx.userProfile.update({
where: {
profileURL: user.profileURL!,
profileURL: user.profileURL ?? undefined,
},
data: {
profileURL: userProfile.profileURL,
profileBio: userProfile.profileBio,
profileURL: profileURL,
},
});
});

View File

@ -80,11 +80,11 @@ export const profileRouter = router({
.input(ZUpdatePublicProfileMutationSchema)
.mutation(async ({ input, ctx }) => {
try {
const { profileURL, profileBio } = input;
const { profileURL } = input;
return await updatePublicProfile({
id: ctx.user.id,
userProfile: { profileURL, profileBio },
profileURL,
});
} catch (err) {
console.error(err);

View File

@ -18,7 +18,6 @@ export const ZUpdateProfileMutationSchema = z.object({
export const ZUpdatePublicProfileMutationSchema = z.object({
profileURL: z.string().min(1),
profileBio: z.string().max(256, { message: 'Profile bio must not exceed 256 characters' }),
});
export const ZUpdatePasswordMutationSchema = z.object({

View File

@ -1,18 +1,24 @@
import Link from 'next/link';
import { cn } from '../lib/utils';
interface AnnouncementBarProps {
isShown: boolean;
className: string;
}
export const AnnouncementBar: React.FC<AnnouncementBarProps> = ({ isShown }) => {
export const AnnouncementBar: React.FC<AnnouncementBarProps> = ({ isShown, className }) => {
return (
isShown && (
<div className="flex h-full w-full items-center justify-center gap-4 border-b-2 bg-green-400 p-1">
<div
className={cn(
'flex h-full w-full items-center justify-center gap-4 border-b-2 p-1',
className,
)}
>
<div className="text-center">
<span className="text-sm text-gray-800">
Claim your documenso public profile URL now!
</span>{' '}
<span className="text-sm font-medium text-gray-800">documenso.com/u/yourname</span>
<span className="text-sm text-white">Claim your documenso public profile URL now!</span>{' '}
<span className="text-sm font-medium text-white">documenso.com/u/yourname</span>
</div>
<div className="flex items-center justify-center gap-4 rounded-lg bg-white px-3 py-1">