Skip to content

Commit

Permalink
Merge branch 'develop' into feature/beta_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
RexBearIU authored Oct 11, 2024
2 parents cdd9203 + 964dc9b commit d3383d5
Show file tree
Hide file tree
Showing 77 changed files with 2,949 additions and 552 deletions.
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "iSunFA",
"version": "0.8.2+35",
"version": "0.8.2+46",
"private": false,
"scripts": {
"dev": "next dev",
Expand Down Expand Up @@ -41,11 +41,14 @@
"next-auth": "^4.24.7",
"next-i18next": "^15.2.0",
"next-logger": "^5.0.0",
"next-qrcode": "^2.5.1",
"next-session": "^4.0.5",
"nodemailer": "^6.9.8",
"pino": "^9.3.2",
"pino-multi-stream": "^6.0.0",
"pino-pretty": "^11.2.2",
"pusher": "^5.2.0",
"pusher-js": "^8.4.0-rc2",
"react": "^18.3.1",
"react-apexcharts": "^1.4.1",
"react-chartjs-2": "^5.2.0",
Expand Down
7 changes: 7 additions & 0 deletions public/icons/asset.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions public/icons/number_sign.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/fake_job_avatar_01.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 4 additions & 0 deletions public/images/fake_job_avatar_02.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/images/fake_preview_cover.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
81 changes: 55 additions & 26 deletions src/components/beta/select_role/introduction.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,28 @@ import React from 'react';
import Image from 'next/image';
import { FiEye, FiArrowRight } from 'react-icons/fi';
import { RoleId } from '@/constants/role';
import { useUserCtx } from '@/contexts/user_context';
import Link from 'next/link';
import { ISUNFA_ROUTE } from '@/constants/url';

interface IntroductionProps {
role: React.SetStateAction<string>;
showingRole: React.SetStateAction<RoleId | null>;
togglePreviewModal: () => void;
}
interface ButtonsProps {
showingRole: RoleId;
togglePreviewModal: () => void;
}
interface BookkeeperIntroductionProps {
showingRole: RoleId;
togglePreviewModal: () => void;
}
interface EducationalTrialVersionIntroductionProps {
showingRole: RoleId;
togglePreviewModal: () => void;
}

const DefaultIntroduction = () => {
const DefaultIntroduction: React.FC = () => {
return (
<section className="h-600px bg-bg_select_role bg-contain bg-right-top bg-no-repeat">
<div className="flex flex-col gap-40px pl-60px pt-60px">
Expand All @@ -26,43 +42,46 @@ const DefaultIntroduction = () => {
);
};

const Buttons = () => {
const handlePreview = () => {
// Deprecated: (20241007 - Liz)
// eslint-disable-next-line no-console
console.log('Preview');
};
const Buttons: React.FC<ButtonsProps> = ({ togglePreviewModal, showingRole }) => {
const { selectRole } = useUserCtx();

const handleStart = () => {
// Deprecated: (20241007 - Liz)
// eslint-disable-next-line no-console
console.log('Start');
console.log('showingRole:', showingRole, '儲存 showingRole 到 userCtx');

selectRole(showingRole);
};

return (
<div className="flex gap-40px">
<button
type="button"
className="flex items-center gap-8px rounded-xs border border-button-stroke-secondary px-32px py-14px text-lg font-medium text-button-text-secondary hover:border-button-stroke-primary-hover hover:text-button-text-primary-hover disabled:border-button-stroke-disable disabled:text-button-text-disable"
onClick={handlePreview}
onClick={togglePreviewModal}
>
<p>Preview</p>
<FiEye size={24} />
</button>

<button
type="button"
className="flex items-center gap-8px rounded-xs bg-button-surface-strong-primary px-32px py-14px text-lg font-medium text-button-text-primary-solid hover:bg-button-surface-strong-primary-hover disabled:bg-button-surface-strong-disable disabled:text-button-text-disable"
onClick={handleStart}
>
<p>Start</p>
<FiArrowRight size={24} />
</button>
<Link href={ISUNFA_ROUTE.JOB_RECORD}>
<button
type="button"
className="flex items-center gap-8px rounded-xs bg-button-surface-strong-primary px-32px py-14px text-lg font-medium text-button-text-primary-solid hover:bg-button-surface-strong-primary-hover disabled:bg-button-surface-strong-disable disabled:text-button-text-disable"
onClick={handleStart}
>
<p>Start</p>
<FiArrowRight size={24} />
</button>
</Link>
</div>
);
};

const BookkeeperIntroduction = () => {
const BookkeeperIntroduction: React.FC<BookkeeperIntroductionProps> = ({
showingRole,
togglePreviewModal,
}) => {
return (
<section className="h-600px bg-bg_bookkeeper bg-contain bg-right-top bg-no-repeat">
<div className="flex flex-col gap-40px pl-60px pt-60px">
Expand All @@ -82,13 +101,16 @@ const BookkeeperIntroduction = () => {
<p>General Ledger, Voucher Issuance, Preparation of Financial and Tax Reports</p>
</div>

<Buttons />
<Buttons showingRole={showingRole} togglePreviewModal={togglePreviewModal} />
</div>
</section>
);
};

const EducationalTrialVersionIntroduction = () => {
const EducationalTrialVersionIntroduction: React.FC<EducationalTrialVersionIntroductionProps> = ({
showingRole,
togglePreviewModal,
}) => {
return (
<section className="h-600px bg-bg_educational_trial_version bg-contain bg-right-top bg-no-repeat">
<div className="flex flex-col gap-40px pl-60px pt-60px">
Expand All @@ -113,18 +135,25 @@ const EducationalTrialVersionIntroduction = () => {
<p>General Ledger, Voucher Issuance</p>
</div>

<Buttons />
<Buttons showingRole={showingRole} togglePreviewModal={togglePreviewModal} />
</div>
</section>
);
};

const Introduction = ({ role }: IntroductionProps) => {
const Introduction: React.FC<IntroductionProps> = ({ showingRole, togglePreviewModal }) => {
return (
<>
{!role && <DefaultIntroduction />}
{role === RoleId.BOOKKEEPER && <BookkeeperIntroduction />}
{role === RoleId.EDUCATIONAL_TRIAL_VERSION && <EducationalTrialVersionIntroduction />}
{!showingRole && <DefaultIntroduction />}
{showingRole === RoleId.BOOKKEEPER && (
<BookkeeperIntroduction showingRole={showingRole} togglePreviewModal={togglePreviewModal} />
)}
{showingRole === RoleId.EDUCATIONAL_TRIAL_VERSION && (
<EducationalTrialVersionIntroduction
showingRole={showingRole}
togglePreviewModal={togglePreviewModal}
/>
)}
</>
);
};
Expand Down
57 changes: 57 additions & 0 deletions src/components/beta/select_role/preview_modal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
import Image from 'next/image';
import { useState } from 'react';
import { IoCloseOutline, IoEllipse } from 'react-icons/io5';

interface PreviewModalProps {
togglePreviewModal: () => void;
}

const PreviewModal = ({ togglePreviewModal }: PreviewModalProps) => {
// ToDo: (20241009 - Liz) 根據 videoIndex 顯示不同影片
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const [videoIndex, setVideoIndex] = useState<number>(0);
const videoIds = ['video1', 'video2', 'video3', 'video4', 'video5'];

return (
<div className="fixed inset-0 z-10 flex items-center justify-center bg-black/50">
<div className="flex w-700px flex-col gap-40px rounded-lg bg-white p-40px">
<section className="flex items-center justify-between">
<h1 className="grow text-center text-xl font-bold text-text-neutral-primary">
Role Function Preview
</h1>
<button type="button" onClick={togglePreviewModal}>
<IoCloseOutline size={24} />
</button>
</section>

{/* // Info: (20241008 - Liz) 預覽影片 */}
<section>
<Image
src={'/images/fake_preview_cover.png'}
alt="fake_preview_cover"
width={620}
height={388}
></Image>
</section>

{/* // Info: (20241008 - Liz) 切換影片控制按鈕 */}
<section className="flex justify-center gap-8px p-16px">
{videoIds.map((id, index) => (
<button
key={id}
type="button"
onClick={() => setVideoIndex(index)}
className={
videoIndex === index ? 'text-carousel-surface-active' : 'text-carousel-surface-mute'
}
>
<IoEllipse size={10} />
</button>
))}
</section>
</div>
</div>
);
};

export default PreviewModal;
24 changes: 12 additions & 12 deletions src/components/beta/select_role/role_card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import Image from 'next/image';
import { RoleId } from '@/constants/role';

interface RoleCardProps {
role: React.SetStateAction<string>;
setRole: React.Dispatch<React.SetStateAction<string>>;
showingRole: React.SetStateAction<RoleId | null>;
setShowingRole: React.Dispatch<React.SetStateAction<RoleId | null>>;
}

interface CardProps {
Expand All @@ -13,8 +13,8 @@ interface CardProps {
title: string;
imageSrc: string;
altText: string;
role: React.SetStateAction<string>;
setRole: React.Dispatch<React.SetStateAction<string>>;
showingRole: React.SetStateAction<RoleId | null>;
setShowingRole: React.Dispatch<React.SetStateAction<RoleId | null>>;
}

// Info: (20241007 - Liz) 每個角色卡片的資訊
Expand Down Expand Up @@ -55,15 +55,15 @@ const Card: React.FC<CardProps> = ({
title,
imageSrc,
altText,
role,
setRole,
showingRole,
setShowingRole,
}) => {
const isRoleSelected = role === roleId;
const isRoleSelected = showingRole === roleId;

return (
<button
type="button"
onClick={() => setRole(roleId)}
onClick={() => setShowingRole(roleId)}
disabled={isRoleDisabled}
className={`relative flex h-120px w-240px skew-x-20 items-center rounded-sm text-text-neutral-primary shadow-Dropshadow_XS disabled:opacity-50 desktop:w-360px ${isRoleSelected ? 'border-2 border-stroke-brand-primary bg-surface-brand-primary-30' : 'bg-surface-neutral-surface-lv2 hover:bg-surface-brand-primary-10'} ${isRoleDisabled && 'pointer-events-none'}`}
>
Expand All @@ -77,13 +77,13 @@ const Card: React.FC<CardProps> = ({
alt={altText}
width={48}
height={48}
className={`absolute -left-50px -top-30px w-160px -skew-x-20 rounded-full ${role === roleId ? 'border-4 border-stroke-brand-primary' : ''}`}
className={`absolute -left-50px -top-30px w-160px -skew-x-20 rounded-full ${showingRole === roleId ? 'border-4 border-stroke-brand-primary' : ''}`}
/>
</button>
);
};

const RoleCard = ({ role, setRole }: RoleCardProps) => {
const RoleCard = ({ showingRole, setShowingRole }: RoleCardProps) => {
return (
<div className="flex gap-80px">
{cards.map((card) => (
Expand All @@ -94,8 +94,8 @@ const RoleCard = ({ role, setRole }: RoleCardProps) => {
title={card.title}
imageSrc={card.imageSrc}
altText={card.altText}
role={role}
setRole={setRole}
showingRole={showingRole}
setShowingRole={setShowingRole}
/>
))}
</div>
Expand Down
5 changes: 1 addition & 4 deletions src/components/certificate/certificate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@ import React, { useState } from 'react';
import Pagination from '@/components/pagination/pagination';
import { ICertificateUI, VIEW_TYPES } from '@/interfaces/certificate';
import CertificateTable from '@/components/certificate/certificate_table';
import CertificateGrid from './certificate_grid';
import CertificateGrid from '@/components/certificate/certificate_grid';

interface CertificateProps {
data: ICertificateUI[]; // Info: (20240923 - tzuhan) 項目列表
viewType: VIEW_TYPES; // Info: (20240923 - tzuhan) 顯示模式
activeTab: number; // Info: (20240926 - tzuhan) 活躍的 Tab
activeSelection: boolean; // Info: (20240923 - tzuhan) 是否處於選擇狀態
handleSelect: (ids: number[], isSelected: boolean) => void;
isSelectedAll: boolean;
Expand All @@ -21,7 +20,6 @@ interface CertificateProps {
const Certificate: React.FC<CertificateProps> = ({
data,
viewType,
activeTab,
activeSelection,
handleSelect,
isSelectedAll,
Expand All @@ -48,7 +46,6 @@ const Certificate: React.FC<CertificateProps> = ({
{viewType === VIEW_TYPES.GRID && (
<CertificateGrid
data={data.slice((currentPage - 1) * itemsPerPage, currentPage * itemsPerPage)}
activeTab={activeTab}
activeSelection={activeSelection}
handleSelect={handleSelect}
onDownload={onDownload}
Expand Down
Loading

0 comments on commit d3383d5

Please sign in to comment.