Skip to content

Commit

Permalink
Merge pull request #67 from Wonchang0314/develop
Browse files Browse the repository at this point in the history
FIX: 얼루가게 이슈
  • Loading branch information
DeveloperRyou authored Apr 2, 2024
2 parents 2b49cb7 + 37b53fd commit 82fef9f
Show file tree
Hide file tree
Showing 9 changed files with 94 additions and 45 deletions.
29 changes: 29 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Run eollugage-fe Test

on:
push:
branches:
- develop
pull_request:
branches:
- develop

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Node.js
uses: actions/setup-node@v1
with:
node-version: "21.2.0"

- name: Install dependencies
run: yarn install

- name: Run test
run: yarn build
2 changes: 1 addition & 1 deletion modules
2 changes: 1 addition & 1 deletion src/assist/ProfileDiscription.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,4 @@ export default function ApprovalProfile({
);
}

//임시 수정
// 임시 수정
2 changes: 1 addition & 1 deletion src/libs/historyToWorkHistory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export function historyToWorkHistory(historys: History[]) {

const workHistoryList: WorkHistory[] = [];

let currentWeekStart = dayjs(sortedHistorys[0].date).startOf("isoWeek");
let currentWeekStart = dayjs(sortedHistorys[0]?.date).startOf("isoWeek"); // history가 없을 경우 에러가 떠서 ? 추가합니다

let weekHistories: History[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/pages/manage/attendance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ export default function Attendance() {
key={index}
name={history.relation.member.name}
position={history.relation.position}
time={`${history.startTime} ~ ${history.endTime}`}
phone="010-0000-0000" // 나중에 수정
/>
</StateButtonWrapper>
))}
Expand Down
67 changes: 35 additions & 32 deletions src/pages/manage/invite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,34 +64,36 @@ export default function Invite() {
};

const handleSaveTime = () => {
const newSchedule = { ...inviteSchedule };

(Object.keys(dayType) as (keyof DayType)[]).forEach(day => {
if (dayType[day] === "workday") {
newSchedule[day] = {
workFrom: `${workFrom.slice(0, 2)}:${workFrom.slice(2)}`,
workUntil: `${workUntil.slice(0, 2)}:${workUntil.slice(2)}`,
restFrom: `${restFrom.slice(0, 2)}:${restFrom.slice(2)}`,
restUntil: `${restUntil.slice(0, 2)}:${restUntil.slice(2)}`,
};
setDayType(prev => {
const newDayType = { ...prev };
newDayType[day] = "inputed";
return newDayType;
});
}
});

setInviteSchedule(newSchedule); // 갱신된 스케줄로 상태 업데이트

setCurrentView("inital_set");

setWorkFrom("0000");
setWorkUntil("0000");
setRestFrom("0000");
setRestUntil("0000");

setIsButtonActive(false);
if (selectedPosition) {
const newSchedule = { ...inviteSchedule };

(Object.keys(dayType) as (keyof DayType)[]).forEach(day => {
if (dayType[day] === "workday") {
newSchedule[day] = {
workFrom: `${workFrom.slice(0, 2)}:${workFrom.slice(2)}`,
workUntil: `${workUntil.slice(0, 2)}:${workUntil.slice(2)}`,
restFrom: `${restFrom.slice(0, 2)}:${restFrom.slice(2)}`,
restUntil: `${restUntil.slice(0, 2)}:${restUntil.slice(2)}`,
};
setDayType(prev => {
const newDayType = { ...prev };
newDayType[day] = "inputed";
return newDayType;
});
}
});

setInviteSchedule(newSchedule); // 갱신된 스케줄로 상태 업데이트

setCurrentView("inital_set");

setWorkFrom("0000");
setWorkUntil("0000");
setRestFrom("0000");
setRestUntil("0000");

setIsButtonActive(false);
}
};

const handleAddEmployee = () => {
Expand All @@ -105,10 +107,11 @@ export default function Invite() {
const isAnyScheduleChanged = Object.values(inviteSchedule).some(
schedule => {
return (
schedule.workFrom !== null ||
schedule.workUntil !== null ||
schedule.restFrom !== null ||
schedule.restUntil !== null
(schedule.workFrom !== null ||
schedule.workUntil !== null ||
schedule.restFrom !== null ||
schedule.restUntil !== null) &&
selectedPosition
);
},
);
Expand Down
12 changes: 5 additions & 7 deletions src/pages/manage/staff.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import WeekButtons, { DayInfo } from "@/screen/manage/WeekButtons";
import Divider from "@modules/layout/Divider";
import FlexBox from "@modules/layout/FlexBox";
import TopTitle from "@modules/layout/TopTitle";
import dayjs from "dayjs";
import { useAtom } from "jotai";
import { useEffect, useState } from "react";

Expand Down Expand Up @@ -86,9 +85,9 @@ export default function Staff() {
<FlexBox direction="col" className="items-start pt-6">
<div className="text-Gray6 B4-medium mb-4 px-4">출퇴근 기록</div>
{histories &&
histories.map(myhistory => (
<>
{myhistory.status != "DECLINED" && (
histories.map(
myhistory =>
myhistory.status !== "DECLINED" && (
<>
<StaffTimeApproval
starttime={myhistory.startTime}
Expand All @@ -98,9 +97,8 @@ export default function Staff() {
/>
<Divider />
</>
)}
</>
))}
),
)}
</FlexBox>
</div>
</div>
Expand Down
21 changes: 20 additions & 1 deletion src/screen/manage/ShareLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,32 @@ function ShareLink() {
const [selectedPosition] = useAtom(selectedPositionAtom);
const [storeId] = useAtom(storeIdAtom);

function filterSchedule(inviteData: InviteDataType): InviteDataType {
const filteredSchedule: InviteSchedule = Object.entries(
inviteData.schedule,
).reduce((acc, [day, schedule]) => {
if (schedule.workFrom !== null) {
acc[day as keyof InviteSchedule] = schedule;
}
return acc;
}, {} as InviteSchedule);

return {
...inviteData,
schedule: filteredSchedule,
};
}

const createQueryString = () => {
const inviteData: InviteDataType = {
storeId,
position: selectedPosition,
schedule: inviteSchedule,
};
const inviteDataString = encodeURIComponent(JSON.stringify(inviteData));

const inviteDataString = encodeURIComponent(
JSON.stringify(filterSchedule(inviteData)),
);
return `/?inviteData=${inviteDataString}`;
};

Expand Down
2 changes: 1 addition & 1 deletion src/screen/manage/StaffInform.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,4 @@ export default function StaffInform() {
);
}

//핸드폰 임시 수정
// 핸드폰 임시 수정

0 comments on commit 82fef9f

Please sign in to comment.