Skip to content

Commit

Permalink
Merge pull request #92 from an920107/frontend-v2
Browse files Browse the repository at this point in the history
Frontend v2
  • Loading branch information
an920107 authored Nov 10, 2024
2 parents bde2016 + 54b0a86 commit f52994a
Show file tree
Hide file tree
Showing 46 changed files with 702 additions and 386 deletions.
35 changes: 2 additions & 33 deletions .github/workflows/frontend-cd.yml
Original file line number Diff line number Diff line change
@@ -1,51 +1,20 @@
name: frontend-cd
on:
workflow_run:
workflows:
- frontend-ci
types:
- completed
push:
branches:
- main
workflow_call:
inputs:
environment:
type: string
required: true
jobs:
deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: frontend-artifact
path: frontend-artifact
github-token: ${{ secrets.GITHUB_TOKEN }}
run-id: ${{ github.event.workflow_run.id }}
- name: Copy files to host
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
source: frontend-artifact
target: /home/${{ secrets.SSH_USERNAME }}/
- name: Deployment
uses: appleboy/[email protected]
with:
host: ${{ secrets.SSH_HOST }}
username: ${{ secrets.SSH_USERNAME }}
password: ${{ secrets.SSH_PASSWORD }}
script: |
git clone https://github.com/${{ github.repository }} repo-tmp --depth=1
mkdir -p repo
cp -r repo-tmp/* repo
rm -rf repo-tmp
cp -r frontend-artifact repo/frontend/docker
git clone https://github.com/${{ github.repository }} repo --depth=1
cd repo
echo NEXT_PUBLIC_BACKEND_HOST=${{ vars.BACKEND_HOST }} > frontend-v2/.env.local
docker compose down
Expand Down
36 changes: 0 additions & 36 deletions .github/workflows/frontend-ci.yml

This file was deleted.

12 changes: 1 addition & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,20 +1,10 @@
version: "3.0"

services:

frontend:
build: frontend/docker
build: frontend-v2
image: health-care-website-frontend
container_name: health-care-website-frontend
networks:
- health-care-website
ports:
- 127.0.0.1:8000:80

frontend-beta:
build: frontend-v2
image: health-care-website-frontend-beta
container_name: health-care-website-frontend-beta
networks:
- health-care-website
ports:
Expand Down
14 changes: 11 additions & 3 deletions frontend-v2/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
FROM node:20-alpine3.20
FROM node:20-alpine3.20 AS dependencies

WORKDIR /package
COPY ./package.json ./yarn.lock ./

RUN yarn install --frozen-lockfile && \
yarn cache clean

FROM dependencies

WORKDIR /app
COPY . .

RUN yarn install && yarn cache clean && yarn run build
RUN mv /package/* . && yarn build

EXPOSE 3000
CMD ["yarn", "run", "start"]
CMD [ "yarn", "run", "start" ]
45 changes: 39 additions & 6 deletions frontend-v2/messages/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"Restaurant": {
"title": "Merchant Inspection Report",
"drink": "Drink",
"food": "Food",
"food": "Ready-to-eat food",
"water": "Water",
"ice": "Ice",
"others": "Others",
Expand All @@ -131,6 +131,9 @@
"table_valid": "Result",
"table_date": "Inspected Date",
"table_edit": "Edit",
"report":"Download Report",
"begin_date": "Start Date",
"end_date": "End Date",
"more": "See more...",
"new": "New Merchant",
"edit": "Edit Merchant",
Expand Down Expand Up @@ -201,13 +204,43 @@
},
"Insurance": {
"title": "Student Insurance",
"table_id": "Number",
"table_name": "Name",
"table_student_id": "Student ID",
"table_application_date": "Application Date",
"table_incident_date": "Incident Date",
"id": "Number",
"name": "Name",
"student_id": "Student ID",
"application_date": "Application Date",
"incident_date": "Occurance Date",
"id_number": "I.D. Number (ARC Or Passport Number)",
"phone_number": "Phone Number",
"address": "Address",
"email": "Email",
"claim_detail": "Claim Detail",
"payment_type": "Category Of Claim",
"location": "Location",
"incident_cause": "Cause Of The Occurance",
"receipt": "Receipt",
"certificate": "Certificate",
"bankbook": "Passbook Copy",
"x_ray": "X-Ray",
"application_amount": "Amount Of Insurance Claim",
"remarks": "Note",
"claim_amount": "Claim Amount",
"claim_date": "Claim Date",
"insurance_company_stamp": "Insurance Company Stamp",
"insurance_company_time": "Insurance Company Stamp Date",
"table_edit": "Edit",
"accident": "Accident",
"illness": "Illness",
"on_campus": "On Campus",
"off_campus": "Off Campus",
"medical": "Medical",
"disablement": "Disablement",
"cancer": "Cancer",
"death": "Death",
"search": "Search by Student ID",
"new": "Create Insurance Record",
"begin_date": "Start Date",
"end_date": "End Date",
"report":"Download Report",
"edit": "Edit Insurance Record",
"delete": "Delete Insurance Record",
"save": "Save Insurance Record"
Expand Down
45 changes: 39 additions & 6 deletions frontend-v2/messages/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
"Restaurant": {
"title": "商家檢查報告",
"drink": "飲料",
"food": "食物",
"food": "即食品",
"water": "飲用水",
"ice": "冰塊",
"others": "其他",
Expand All @@ -131,6 +131,9 @@
"table_valid": "檢驗結果",
"table_date": "抽檢日期",
"table_edit": "編輯",
"report": "下載報表",
"begin_date": "開始日期",
"end_date": "結束日期",
"more": "查看更多...",
"new": "新增商家",
"edit": "編輯商家",
Expand Down Expand Up @@ -194,12 +197,42 @@
},
"Insurance": {
"title": "學生團體保險",
"table_id": "編號",
"table_name": "姓名",
"table_student_id": "學號",
"table_application_date": "申請日期",
"table_incident_date": "事故日期",
"id": "編號",
"name": "姓名",
"student_id": "學號",
"application_date": "申請日期",
"incident_date": "事故日期",
"id_number": "身分證字號(居留證或護照號碼)",
"phone_number": "電話號碼",
"address": "地址",
"email": "電子郵件",
"claim_detail": "理賠詳情",
"payment_type": "理賠類別",
"location": "地點",
"incident_cause": "事故原因(簡述)",
"receipt": "收據(醫院名稱 + 份數)",
"certificate": "診斷書(醫院名稱 + 份數)",
"bankbook": "存摺影本",
"x_ray": "X 光",
"application_amount": "申請金額",
"remarks": "備註",
"claim_amount": "理賠金額",
"claim_date": "理賠日期",
"insurance_company_stamp": "保險公司收件核章",
"insurance_company_time": "保險公司收件核章日期",
"table_edit": "編輯",
"accident": "事故",
"illness": "疾病",
"on_campus": "校內",
"off_campus": "校外",
"medical": "醫療",
"disablement": "失能",
"cancer": "初次罹癌",
"death": "身故",
"search": "搜尋學號",
"report": "下載報表",
"begin_date": "開始日期",
"end_date": "結束日期",
"new": "新增保險記錄",
"edit": "編輯保險記錄",
"delete": "刪除保險記錄",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ export default function CarouselEditor({

const usecase = new CarouselUsecase(new CarouselRepoImpl());

const titleValidations = [
const titleValidations = (length: number) => [
new NotEmptyValidationUsecase(trans("validate_empty")),
new LengthValidationUsecase(40, trans("validate_length", { length: 40 })),
new LengthValidationUsecase(length, trans("validate_length", { length: length })),
];

function handleValidate(result: boolean) {
Expand Down Expand Up @@ -144,7 +144,7 @@ export default function CarouselEditor({
value={chineseTitle}
onChange={setChineseTitle}
onValidate={handleValidate}
validations={titleValidations}
validations={titleValidations(40)}
toValidate={toValidate}
/>
<QuillEditor label={trans("chinese_content")} value={chineseContent} onChange={setChineseContent} />
Expand All @@ -153,7 +153,7 @@ export default function CarouselEditor({
value={englishTitle}
onChange={setEnglishTitle}
onValidate={handleValidate}
validations={titleValidations}
validations={titleValidations(100)}
toValidate={toValidate}
/>
<QuillEditor label={trans("english_content")} value={englishContent} onChange={setEnglishContent} />
Expand Down
2 changes: 0 additions & 2 deletions frontend-v2/src/app/[locale]/admin/dengue/building-panel.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ export default function BuildingPanel({
<Table.Row>
<Table.ColumnHeaderCell>{trans("table_name")}</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>{trans("table_user")}</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>{trans("table_status")}</Table.ColumnHeaderCell>
<Table.ColumnHeaderCell>{trans("table_delete")}</Table.ColumnHeaderCell>
</Table.Row>
</Table.Header>
Expand All @@ -88,7 +87,6 @@ export default function BuildingPanel({
/>
</span>
</Table.Cell>
<Table.Cell>{"IN_DEVELOPMENT"}</Table.Cell>
<Table.Cell>
<FontAwesomeIcon
icon={faTrash}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,9 @@ export default function DownloadEditor({
setReleaseStatus(download?.releaseStatus ?? ReleaseStatusEnum.Draft);
}, [download]);

const titleValidations = [
const titleValidations = (length: number) => [
new NotEmptyValidationUsecase(trans("validate_empty")),
new LengthValidationUsecase(40, trans("validate_length", { length: 40 })),
new LengthValidationUsecase(length, trans("validate_length", { length: length })),
];

function handleValidate(result: boolean) {
Expand Down Expand Up @@ -127,15 +127,15 @@ export default function DownloadEditor({
value={title}
onChange={setTitle}
onValidate={handleValidate}
validations={titleValidations}
validations={titleValidations(40)}
toValidate={toValidate}
/>
<TextField
label={trans("english_title")}
value={titleEn}
onChange={setTitleEn}
onValidate={handleValidate}
validations={titleValidations}
validations={titleValidations(100)}
toValidate={toValidate}
/>
<div className="flex flex-row justify-end gap-2">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ export default function DownloadEditPage({ params }: Props) {
return (
<>
<h1>編輯下載</h1>
<DownloadEditor className="mt-6" download={download} />
{
download === undefined
? <></>
: <DownloadEditor className="mt-6" download={download} />
}
</>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ type Props = {

const usecase = new InsuranceUsecase(new InsuranceRepoImpl());

export default async function EditInsurancePage({ params }: Props) {
export default function EditInsurancePage({ params }: Props) {
const router = useRouter();
const pathname = usePathname();

Expand Down
Loading

0 comments on commit f52994a

Please sign in to comment.