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

Sun/fdr 77 register done #179

Merged
merged 12 commits into from
Jul 28, 2024
5,630 changes: 2,515 additions & 3,115 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions public/rpkm/freshy-night/register-done/vector.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
27 changes: 16 additions & 11 deletions src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,20 @@
@tailwind utilities;

@layer {
.bg-1 {
background-image: url('https://rpkm67.sgp1.cdn.digitaloceanspaces.com/assets/bg-1.svg');
background-repeat: repeat;
background-size: cover;
}
.bg-1 {
background-image: url('https://rpkm67.sgp1.cdn.digitaloceanspaces.com/assets/bg-1.svg');
background-repeat: repeat;
background-size: cover;
}

.bg-2 {
background-image: url('https://rpkm67.sgp1.cdn.digitaloceanspaces.com/assets/bg-2.svg');
background-repeat: repeat;
background-size: cover;
}
}
.bg-2 {
background-image: url('https://rpkm67.sgp1.cdn.digitaloceanspaces.com/assets/bg-2.svg');
background-repeat: repeat;
background-size: cover;
}

.font-outline {
-webkit-text-stroke-width: 1pt;
-webkit-text-stroke-color: #183f86;
}
}
42 changes: 42 additions & 0 deletions src/app/rpkm/freshy-night/register-done/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
'use client';

import { useState } from 'react';
import { useAuth } from '@/context/AuthContext';

import BottomButton from '@/components/(main)/home/BottomButton';
import QrCodeModal from '@/components/rpkm/freshy-night/QrCodeModal';
import qrcodeIcon from '@public/home/icon/qrcode.svg';

export default function RegisterDone() {
const [qrModal, setQrModal] = useState<boolean>(false);

const { user } = useAuth();

return (
<>
<div className="bg-[#FFFEF7E5] w-11/12 mx-auto py-[5%] flex flex-col items-center gap-y-5 [clip-path:polygon(1rem_0,calc(100%-1rem)_0,100%_1rem,100%_calc(100%-1rem),calc(100%-1rem)_100%,1rem_100%,0_calc(100%-1rem),0_1rem)]">
<div className="text-center font-sopha font-outline">
<p className="text-project-pastel-pink text-8xl/[5rem] [text-shadow:_2px_2px_2px_rgb(0_0_0_/_30%)]">
ลงทะเบียน
</p>
<p className="text-project-yellow text-9xl/[2.5rem] tracking-wide [text-shadow:_2px_2px_2px_rgb(0_0_0_/_30%)]">
<span className="-mr-5">ส</span> ำเร็จ
</p>
</div>
<div className="w-full h-[50vh] flex justify-center items-center">
<p className="text-3xl font-mono font-bold">Waited...</p>
</div>
<BottomButton
onClick={() => setQrModal(true)}
src={qrcodeIcon}
text="My Qr"
/>
</div>
<QrCodeModal
setOpen={setQrModal}
open={qrModal}
userId={user ? user.id : ''}
/>
</>
);
}
7 changes: 7 additions & 0 deletions src/components/rpkm/Modal/ModalStyle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const modalStyles = {
'cancel-border': 'bg-[#F5F5F5]',
},
},
'dark-blue': {
button: {
'accept-background': 'bg-[#183F86] text-[#FFF]',
'accept-border': 'bg-[#EFD08B]',
width: 'w-3/4',
},
},
green: {
background: 'bg-[#67AB88]',
button: {
Expand Down
43 changes: 43 additions & 0 deletions src/components/rpkm/freshy-night/ModalButton.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import { cn } from '@/lib/utils';

interface ModalButtonProps {
callBackFunction: (params: unknown) => void;
borderClassName: string;
backgroundClassName: string;
buttonWidth?: string | 'w-2/5';
children: React.ReactNode;
}

/**
* ModalButton component
* @param callBackFunction - function
* @param borderClassName - string
* @param backgroundClassName - string
* @param children - ReactNode
* @returns Styled button component
*/
const ModalButton: React.FC<ModalButtonProps> = ({
callBackFunction,
borderClassName,
backgroundClassName,
buttonWidth,
children,
}) => {
return (
<button
onClick={callBackFunction}
className={cn('p-1 inv-rad inv-rad-2', borderClassName, buttonWidth)}
>
<div
className={cn(
'py-[0.3rem] px-2 inv-rad inv-rad-2',
backgroundClassName
)}
>
{children}
</div>
</button>
);
};

export default ModalButton;
92 changes: 92 additions & 0 deletions src/components/rpkm/freshy-night/QrCodeModal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import { useEffect, useState } from 'react';
import Image from 'next/image';
import { useQRCode } from 'next-qrcode';

import ModalButton from '@/components/rpkm/freshy-night/ModalButton';
import modalStyles from '../Modal/ModalStyle';
import qrOuterBackground from '@public/rpkm/freshy-night/register-done/qr-outer-background.svg';
import qrInnerBackground from '@public/rpkm/freshy-night/register-done/qr-inner-background.svg';
import vector from '@public/rpkm/freshy-night/register-done/vector.svg';

interface QrCodeModalProps {
setOpen: (value: boolean) => void;
open: boolean;
userId: string;
}

export default function QrCodeModal({
setOpen,
open,
userId,
}: QrCodeModalProps) {
const [viewportHeight, setViewportHeight] = useState<number>(0);

useEffect(() => {
const handleResize = () => {
setViewportHeight(0.25 * window.innerHeight);
};

// Initial setup
handleResize();

// Event listener for window resize
window.addEventListener('resize', handleResize);

// Clean up event listener
return () => {
window.removeEventListener('resize', handleResize);
};
}, []);

const { Canvas } = useQRCode();

if (!open) return null;

return (
<div className="z-10 inset-0 fixed flex justify-center bg-black bg-opacity-50 self-center">
<div className="w-[calc(100vh*(72/156)*(9/10))] h-[64vh] relative self-center flex flex-col justify-center">
<div
className="w-4/5 h-full opacity-100 self-center flex justify-self-center justify-center bg-contain bg-no-repeat bg-center"
style={{ backgroundImage: `url(${qrOuterBackground.src})` }}
>
<div
className="w-11/12 h-[46vh] opacity-100 self-center justify-self-center bg-contain bg-no-repeat bg-center flex flex-col items-center justify-around py-[2vh]"
style={{ backgroundImage: `url(${qrInnerBackground.src})` }}
>
<h5 className="font-athiti text-3xl font-medium">My QR</h5>
<Image
src={vector}
alt="vector"
className="w-3/5"
/>
<Canvas
text={userId}
options={{
width: viewportHeight,
}}
/>
<ModalButton
callBackFunction={() => setOpen(false)}
borderClassName={modalStyles['dark-blue'].button['accept-border']}
backgroundClassName={
modalStyles['dark-blue'].button['accept-background']
}
buttonWidth={modalStyles['dark-blue'].button.width}
>
ย้อนกลับ
</ModalButton>
</div>
</div>
</div>
</div>
// <div className="z-10 inset-0 fixed flex justify-center bg-black bg-opacity-50 self-center">
// <div className="w-[calc(100vh*(72/156)*(9/10))] h-[64vh] relative self-center flex flex-col justify-center">
// <div
// className="w-4/5 h-full bg-contain bg-no-repeat bg-center flex flex-col items-center"
// style={{ backgroundImage: `url(${qrInnerBackground.src})` }}
// >
// </div>
// </div>
// </div>
);
}
1 change: 1 addition & 0 deletions tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const config: Config = {
},
dropShadow: {
font: '0 1.2px 1.2px rgba(0,0,0,0.8)',
text2: '0px 2px 2px 2px #00000040',
},
animation: {
shake: 'shaking 60ms infinite',
Expand Down
Loading