Skip to content

Commit

Permalink
release: v1.2.5
Browse files Browse the repository at this point in the history
  • Loading branch information
joshxfi authored Nov 1, 2023
2 parents cc3fd4e + a0e56b7 commit 9cb3193
Show file tree
Hide file tree
Showing 25 changed files with 448 additions and 142 deletions.
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"@tanstack/react-query": "^5.0.5",
"@umamin/db": "*",
"@umamin/generated": "*",
"@vercel/og": "^0.5.20",
"bcrypt": "^5.1.0",
"bcryptjs": "^2.4.3",
"class-validator": "^0.14.0",
Expand Down
Binary file removed apps/web/public/fonts/Inter-Medium.woff2
Binary file not shown.
Binary file removed apps/web/public/fonts/Syne-ExtraBold.woff2
Binary file not shown.
32 changes: 18 additions & 14 deletions apps/web/src/components/Dialog/Message.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { HiOutlineSave, HiPuzzle, HiTrash } from 'react-icons/hi';
import { useMutation } from '@tanstack/react-query';
import { toPng } from 'html-to-image';
import toast from 'react-hot-toast';
import { nanoid } from 'nanoid';

import { useLogEvent } from '@/hooks';
import { deleteMessage } from '@/api';
Expand Down Expand Up @@ -40,23 +39,28 @@ export const MessageDialog = ({
const [deleteModal, setDeleteModal] = useState(false);

const saveImage = useCallback(() => {
toast('Downloading image', { icon: '📥' });

if (cardRef.current === null) {
return;
}

toPng(cardRef.current, { cacheBust: true, pixelRatio: 5 })
.then((dataUrl) => {
const link = document.createElement('a');
link.download = `${user?.username}_${nanoid(5)}.png`;
link.href = dataUrl;
link.click();
toast.success('Image downloaded');
})
.catch((err) => {
toast.error(err);
});
toast.promise(
toPng(cardRef.current, { cacheBust: true, pixelRatio: 3 })
.then((dataUrl) => {
const link = document.createElement('a');
link.download = `${user?.username}_${id}.png`;
link.href = dataUrl;
link.click();
})
.catch((err) => {
toast.error(err);
}),
{
loading: 'Saving image...',
success: 'Image saved',
error: 'Failed to save image',
}
);

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [cardRef]);

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Dialog/Reply.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export const ReplyDialog = ({
>
<div className='dark:border-secondary-100 dark:bg-secondary-200 w-full overflow-hidden rounded-2xl border-2 border-gray-400 bg-gray-200'>
<div className='dark:border-secondary-100 border-b-2 border-gray-400 bg-gray-300 py-3 dark:bg-[#171819]'>
<h3 className='font-syneExtrabold text-primary-200 text-center text-base'>
<h3 className='font-syne font-extrabold text-primary-200 text-center text-base'>
umamin
</h3>
</div>
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/InboxTabs/Recent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export const Recent = () => {
onClick={() => handleOpen(m)}
className='msg-card relative w-full cursor-pointer scroll-mt-6 overflow-hidden text-left'
>
<h3 className='font-syneExtrabold text-gradient mb-4 text-center text-3xl'>
<h3 className='font-syne font-extrabold text-gradient mb-4 text-center text-3xl'>
umamin
</h3>

Expand Down
30 changes: 19 additions & 11 deletions apps/web/src/components/InboxTabs/SeenCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,16 +64,24 @@ export const SeenCard = ({ message, refetch }: Props) => {
return;
}

toPng(cardRef.current, { cacheBust: true, pixelRatio: 5 })
.then((dataUrl) => {
const link = document.createElement('a');
link.download = `${user?.username}_${id}.png`;
link.href = dataUrl;
link.click();
})
.catch((err) => {
toast.error(err);
});
toast.promise(
toPng(cardRef.current, { cacheBust: true, pixelRatio: 3 })
.then((dataUrl) => {
const link = document.createElement('a');
link.download = `${user?.username}_${id}.png`;
link.href = dataUrl;
link.click();
})
.catch((err) => {
toast.error(err);
}),
{
loading: 'Saving image...',
success: 'Image saved',
error: 'Failed to save image',
}
);

// eslint-disable-next-line react-hooks/exhaustive-deps
}, [cardRef]);

Expand Down Expand Up @@ -118,7 +126,7 @@ export const SeenCard = ({ message, refetch }: Props) => {
<HiDownload />
</button>

<h3 className='font-syneExtrabold text-primary-200 mx-auto text-base'>
<h3 className='font-syne font-extrabold text-primary-200 mx-auto text-base'>
umamin
</h3>

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/InboxTabs/SentCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export const SentCard = ({ data }: { data: SentMessage }) => {
</span>{' '}
{receiverUsername}
</p>
<h3 className='font-syneExtrabold text-gradient text-center text-base'>
<h3 className='font-syne font-extrabold text-gradient text-center text-base'>
umamin
</h3>
</div>
Expand Down
2 changes: 2 additions & 0 deletions apps/web/src/components/UserForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ export const UserForm = ({ type, onRegister, loading }: Props) => {
<div className='flex space-x-2'>
<button
type='button'
disabled={isLoading}
className='bg-dcblue hover:bg-dcblue/80 btn flex w-full items-center justify-center space-x-2 text-white'
onClick={() => {
signIn('discord');
Expand All @@ -225,6 +226,7 @@ export const UserForm = ({ type, onRegister, loading }: Props) => {
</button>
<button
type='button'
disabled={isLoading}
className='btn flex w-full items-center justify-center space-x-2 bg-white font-semibold text-black hover:bg-white/80'
onClick={() => {
signIn('google');
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/Utils/ImageFill.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface ImageFillProps
export const ImageFill = ({ src, className, ...rest }: ImageFillProps) => {
return (
<div className={`relative overflow-hidden ${className}`}>
<Image src={src || '/icons/icon-144.png'} fill {...rest} />
<Image src={src || '/icons/icon-96.png'} fill {...rest} />
</div>
);
};
3 changes: 3 additions & 0 deletions apps/web/src/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
import type { NextPage } from 'next';
import type { ReactElement, ReactNode } from 'react';

/* eslint-disable no-unused-vars */
export {};

Expand Down
17 changes: 17 additions & 0 deletions apps/web/src/lib/db.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { PrismaClient } from '@umamin/db';

const prismaClientSingleton = () => {
return new PrismaClient();
};

type PrismaClientSingleton = ReturnType<typeof prismaClientSingleton>;

const globalForPrisma = globalThis as unknown as {
prisma: PrismaClientSingleton | undefined;
};

const prisma = globalForPrisma.prisma ?? prismaClientSingleton();

export default prisma;

if (process.env.NODE_ENV !== 'production') globalForPrisma.prisma = prisma;
27 changes: 22 additions & 5 deletions apps/web/src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,19 @@ import {
} from '@tanstack/react-query';
import { SessionProvider } from 'next-auth/react';
import toast, { Toaster } from 'react-hot-toast';
import type { AppProps } from 'next/app';
import { Inter, Syne } from 'next/font/google';
import { DefaultSeo } from 'next-seo';
import NProgress from 'nprogress';
import 'nprogress/nprogress.css';
import Router from 'next/router';

import '../styles/globals.css';
import type { AppProps } from 'next/app';
import type { Session } from 'next-auth';
import type { DehydratedState } from '@tanstack/react-query';

import { ErrorBoundary, Maintenance } from '@/components';

import '../styles/globals.css';
import SEO from '../../next-seo-config';
import type { NextPageWithLayout } from '..';

Expand All @@ -27,10 +31,16 @@ Router.events.on('routeChangeStart', () => {
Router.events.on('routeChangeComplete', () => NProgress.done());
Router.events.on('routeChangeError', () => NProgress.done());

type AppPropsWithLayout = AppProps<{ session: any; dehydratedState: any }> & {
Component: NextPageWithLayout;
type AppPropsWithLayout = AppProps<{
session: Session;
dehydratedState: DehydratedState;
}> & {
Component: NextPageWithLayout<{ dehydratedState: DehydratedState }>;
};

const inter = Inter({ subsets: ['latin'] });
const syne = Syne({ subsets: ['latin'], variable: '--font-syne' });

function MyApp({
Component,
pageProps: { session, ...pageProps },
Expand Down Expand Up @@ -79,7 +89,14 @@ function MyApp({
<Maintenance />
) : (
<ErrorBoundary>
{getLayout(<Component {...pageProps} />)}
<style jsx global>{`
html {
font-family: ${inter.style.fontFamily};
}
`}</style>
<main className={syne.variable}>
{getLayout(<Component {...pageProps} />)}
</main>
</ErrorBoundary>
)}
<Toaster
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/_document.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default function Document() {
return (
<Html className='dark scroll-smooth'>
<Head />
<body className='dark:bg-secondary-300 font-inter text-secondary-300 bg-[#e2e2e2] dark:text-white'>
<body className='dark:bg-secondary-300 text-secondary-300 bg-[#e2e2e2] dark:text-white'>
<Main />
<NextScript />
<Script
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/api/auth/[...nextauth].ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/* eslint-disable no-param-reassign */
import { prisma } from '@/utils/db';
import prisma from '@/lib/db';
import NextAuth, { NextAuthOptions } from 'next-auth';
import GoogleProvider from 'next-auth/providers/google';
import { PrismaAdapter } from '@next-auth/prisma-adapter';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/api/authorize.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { NextApiRequest, NextApiResponse } from 'next';
import { z } from 'zod';

import { prisma } from '@/utils/db';
import prisma from '@/lib/db';
import { isPassword } from '@/utils/helpers';

export const userSchema = z.object({
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/pages/api/graphql.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { NextApiRequest, NextApiResponse } from 'next/types';
import { ApolloServer } from '@apollo/server';
import { getSession } from 'next-auth/react';
import { buildSchema } from 'type-graphql';
import { prisma } from '@/utils/db';

import prisma from '@/lib/db';
import { UserResolver } from '@/schema/user';
import { MessageResolver } from '@/schema/message';

Expand Down
Loading

1 comment on commit 9cb3193

@vercel
Copy link

@vercel vercel bot commented on 9cb3193 Nov 1, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

umamin – ./

umamin-git-main-omsimos.vercel.app
umamin-omsimos.vercel.app
umamin.link
www.umamin.link

Please sign in to comment.