mirror of
https://github.com/documenso/documenso.git
synced 2025-11-12 15:53:02 +10:00
BIN
packages/assets/images/Lucas.png
Normal file
BIN
packages/assets/images/Lucas.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
packages/assets/images/Timur.png
Normal file
BIN
packages/assets/images/Timur.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 8.9 KiB |
BIN
packages/assets/images/background-lw-2.png
Normal file
BIN
packages/assets/images/background-lw-2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 104 KiB |
@ -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,
|
||||
},
|
||||
});
|
||||
};
|
||||
@ -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,
|
||||
},
|
||||
});
|
||||
});
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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({
|
||||
|
||||
@ -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">
|
||||
|
||||
Reference in New Issue
Block a user