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

[Fix/#294] 우선순위 입력 페이지에서 가능시간 입력 페이지로 되돌아가면 우선순위 초기화 #295

Merged
merged 46 commits into from
Aug 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
887f8e9
fix: 네비게이션 모달 z-index변경
ljh0608 Jul 29, 2024
b83bb5e
fix: x버튼 네비게이션바에 정상적으로 보이도록
ljh0608 Jul 29, 2024
453786a
fix: 시간입력 로직에서 뒤로가기했을 때 우선순위 초기화
ljh0608 Jul 29, 2024
3288a6d
feat: 우선순위 드롭다운 날짜/시간순으로 정렬
ljh0608 Jul 29, 2024
9c0ba8f
refactor: 중복코드 개선
ljh0608 Jul 29, 2024
6a94a11
refactor: 뷰 중복코드 개선
ljh0608 Jul 29, 2024
6e833aa
fix: toSorted 배포상 이슈로 slice메소드와 sort메소드 사용으로 변경
ljh0608 Jul 29, 2024
00fc5d5
refactor: useEffect 내부 함수 분리
ljh0608 Aug 7, 2024
badc10e
fix: 우선순위 초기화 로직 개선
ljh0608 Aug 8, 2024
e74fe5e
chore: resetHandle useEffect 중복 로직 삭제
ljh0608 Aug 10, 2024
c5f1297
feat: recoil-persist 적용
simeunseo Jul 27, 2024
a4afb65
feat: Timetable 컴포넌트에 slotUnit prop추가하여 적용
simeunseo Jul 27, 2024
82fdfc8
feat: 우선순위 뷰에서 선택된 슬롯에는 border 제거
simeunseo Jul 27, 2024
b70d477
feat: 우선순위 숫자 표시 스타일링
simeunseo Jul 27, 2024
59b11d4
fix: SlotTitle 색상 변경
simeunseo Jul 27, 2024
da1d46d
fix: slot의 스타일링에 대한 로직을 Column 컴포넌트로 이동
simeunseo Jul 27, 2024
5b2463d
docs: slot 스타일링 관련 주석
simeunseo Jul 27, 2024
662ddba
feat: 우선순위 subtitle 추가
simeunseo Jul 27, 2024
5ee72ab
fix: SlotTitle에만 slotUnit prop 내려주기
simeunseo Jul 27, 2024
ed9af49
chore: 주석 수정
simeunseo Jul 27, 2024
4307dc7
feat: 맨 첫번째 Slot은 그라디언트 적용
simeunseo Jul 27, 2024
c7d3c94
feat: react-lottie 설치 및 stylelint-config-prettier 의존성삭제
simeunseo Aug 4, 2024
69d9f7b
feat: useModalState 구현
simeunseo Aug 4, 2024
e7c38c3
feat: 온보딩 로티 삽입
simeunseo Aug 4, 2024
fa61c71
feat: CTA 부자연스러움 관련 처리
simeunseo Aug 4, 2024
3f7f222
fix: 로티와 싱크 맞추기 위한 수정
simeunseo Aug 4, 2024
b042fec
fix: 모달 background position fixed로 변경
simeunseo Aug 4, 2024
35a654d
fix: atom, molecules, timetable Components를 모두 common 폴더로 이동
simeunseo Aug 4, 2024
927697a
fix: 시간 입력 margin-bottom 위치 수정
simeunseo Aug 4, 2024
b5064a9
fix: OverallSchedule에도 margin-bottom 추가
simeunseo Aug 4, 2024
7db8a09
fix: macro 삭제
simeunseo Aug 8, 2024
44887d0
fix: stylelintrc에서 stylelint-config-prettier 삭제
simeunseo Aug 8, 2024
9b704a0
feat: 방 정보입력 프로그레스바 구현
ljh0608 Jul 28, 2024
cd73519
fix: 선호시간대 입력 페이지 삭제
simeunseo Jul 19, 2024
60a6245
rebase merge
ljh0608 Aug 7, 2024
2d9b3c8
충돌 해결
ljh0608 Aug 7, 2024
7b154d0
feat: Timetable 컴포넌트에 slotUnit prop추가하여 적용
simeunseo Jul 27, 2024
e70cdf9
feat: 우선순위 숫자 표시 스타일링
simeunseo Jul 27, 2024
71da64f
fix: slot의 스타일링에 대한 로직을 Column 컴포넌트로 이동
simeunseo Jul 27, 2024
ff52666
docs: slot 스타일링 관련 주석
simeunseo Jul 27, 2024
5f5824f
fix: SlotTitle에만 slotUnit prop 내려주기
simeunseo Jul 27, 2024
34c2f0e
fix: 헤더와 프로그레스바 간격추가, transition추가
ljh0608 Aug 7, 2024
06968a9
chore: 사용하지 않는 변수 삭제
ljh0608 Aug 7, 2024
0278b8e
test: test commit
ljh0608 Aug 10, 2024
26288e2
chore: PR build 실패시 PR닫는로직 제거
ljh0608 Aug 10, 2024
b760a34
fix: merge develop
simeunseo Aug 11, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
name: CI

on:
pull_request:
branches: ['main']
push:
branches: [ "main" ]

jobs:
build:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies
run: yarn install

- name: Build # 빌드
run: yarn build

- name: Close PR, if build fails
if: ${{ failure() }}
uses: actions/github-script@v6
with:
github-token: ${{ github.TOKEN }}
script: |
const pull_number = ${{ github.event.pull_request.number }}
const updated_title = `[BUILD FAIL] ${{ github.event.pull_request.title }}`
await github.rest.pulls.createReview({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
body: '빌드에 실패했습니다.',
event: 'REQUEST_CHANGES'
})
await github.rest.pulls.update({
owner: context.repo.owner,
repo: context.repo.repo,
pull_number: pull_number,
title: updated_title,
state: 'closed'
})

push_main:
runs-on: ubuntu-latest
container: pandoc/latex
steps:
- uses: actions/checkout@v2
- name: Install mustache (to update the date)
run: apk add ruby && gem install mustache
- name: creates output
run: sh ./build.sh
- name: Pushes to another repository
id: push_directory
uses: cpina/github-action-push-to-another-repository@main
env:
API_TOKEN_GITHUB: ${{ secrets.AUTO_ACTIONS }}
with:
source-directory: 'output'
destination-github-username: ljh0608
destination-repository-name: ASAP_Client
user-email: ${{ secrets.LEAD_EMAIL }}
commit-message: ${{ github.event.commits[0].message }}
target-branch: main
- name: Test get variable exported by push-to-another-repository
run: echo $DESTINATION_CLONED_DIRECTORY
4 changes: 2 additions & 2 deletions src/components/common/moleculesComponents/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,10 +113,10 @@ function Header({ position, setFunnelStep }: HeaderProps) {
</HeaderSection>
{isNaviOpen ? (
<NavigationSection>
<NavigationContainer>
<IconContainer onClick={() => setIsNaviOpen((prev) => !prev)}>
<ExitIc />
</IconContainer>
<NavigationContainer>
<Navigation navigationOptions={navigationOptions}/>
</NavigationContainer>
</NavigationSection>
Expand Down Expand Up @@ -160,7 +160,7 @@ const NavigationSection = styled.section`
position: absolute;
top: 0;
right: 0;
z-index: 1;
z-index: 2;
background-color: rgba(0, 0, 0, 0.7);
width: 100%;
height: 100vh;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import styled from 'styled-components';

function PriorityCta() {
const [isModalOpen, setIsModalOpen] = useState(false);

return (
<>
<BtnDim>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,27 +20,35 @@ function PriorityDropdown() {
const { selectedSlots, setSelectedSlots } = useSelectContext();
const [isOpenDropDown, setIsOpenDropDown] = useState([false, false, false]);

//우선 순위 시간순 정렬을 위한 날짜 시간 파싱함수
const parseDateTime = (dateStr: string, timeStr: string) => {
const [month, day] = dateStr.split('/');
const formatDay = day.padStart(2, '0');
const [hour, minute] = timeStr.split(':');
return Number(month + formatDay + hour + minute);
};

const sortedSlots = Object.entries(selectedSlots)
.slice()
.sort(
(a, b) => parseDateTime(a[1].date, a[1].startSlot) - parseDateTime(b[1].date, b[1].startSlot),
);

const formatDate = (date: string) => {
const [month, day, dayOfWeek] = date.split('/');
return `${month}/${day}(${dayOfWeek})`;
};

let defaultInput1 = '';
let defaultInput2 = '';
let defaultInput3 = '';
for (const key in selectedSlots) {
const item = selectedSlots[key];
const defaultInputs = Array(3).fill('');
Object.values(selectedSlots).forEach((item) => {
const date = formatDate(item.date);
const endSlot = addMinutes(item.endSlot, 30);
if (item.priority === 3) {
defaultInput1 = `${date} ${item.startSlot}~${endSlot}`;
} else if (item.priority === 2) {
defaultInput2 = `${date} ${item.startSlot}~${endSlot}`;
} else if (item.priority === 1) {
defaultInput3 = `${date} ${item.startSlot}~${endSlot}`;
if (item.priority > 0) {
defaultInputs[3 - item.priority] = `${date} ${item.startSlot}~${endSlot}`;
}
}
const [input_, setInput] = useState<string[]>([defaultInput1, defaultInput2, defaultInput3]);
});

const [input_, setInput] = useState<string[]>(defaultInputs);

const handleDropdown = (idx: number) => {
//dropdown이 열려있을 때
Expand All @@ -62,28 +70,13 @@ function PriorityDropdown() {

const handlePriority = (idx: number, item: SelectSlotType, stringSelectedSlotKey: string) => {
const selectedSlotKey = parseInt(stringSelectedSlotKey);
let selectedPriority: 0 | 1 | 2 | 3 = 0;
switch (idx) {
case 0:
selectedPriority = 3;
break;
case 1:
selectedPriority = 2;
break;
case 2:
selectedPriority = 1;
break;
default:
selectedPriority = 0;
break;
}

const selectedPriority = 3 - idx;
//이전 상태를 순회하면서 선택된 우선순위를 가지고 있는 데이터를 우선순위 0으로 초기화
setSelectedSlots((prev: SelectedSlotType) => {
const updatedSelectedSlots = Object.entries(prev).reduce(
(acc, [key, value]) => {
const prevSelectedSlotKey = parseInt(key);
//선택된 우선순위가 기존에 존재할 경우 0으로 초기화
//우선순위를 선택한 후 다시 설정할 경우 기존 priority 0으로 초기화
if (value.priority === selectedPriority) {
acc[prevSelectedSlotKey] = { ...value, priority: 0 };
} else {
Expand All @@ -109,15 +102,8 @@ function PriorityDropdown() {
const updatedInput = [...prev];
const endSlot = addMinutes(item.endSlot, 30);
const date = formatDate(item.date);
if (idx === 0) {
updatedInput[idx] = `${date} ${item.startSlot}~${endSlot}`;
} else if (idx === 1) {
updatedInput[idx] = `${date} ${item.startSlot}~${endSlot}`;
} else if (idx === 2) {
updatedInput[idx] = `${date} ${item.startSlot}~${endSlot}`;
} else {
updatedInput[idx] = 'error';
}

updatedInput[idx] = `${date} ${item.startSlot}~${endSlot}`;
return updatedInput;
});
handleDropdown(idx);
Expand All @@ -134,15 +120,7 @@ function PriorityDropdown() {
{`${idx + 1}`}순위
</Text>
</TextWrapper>
{idx === 0 ? (
<Circle1Icon />
) : idx === 1 ? (
<Circle2Icon />
) : idx === 2 ? (
<Circle3Icon />
) : (
<div />
)}
{idx === 0 ? <Circle1Ic /> : idx === 1 ? <Circle2Ic /> : <Circle3Ic />}
</CircleWrapper>
<InputWrapper>
<TimeInput
Expand All @@ -153,20 +131,12 @@ function PriorityDropdown() {
onClick={() => handleDropdown(idx)}
value={input_[idx]}
/>

{isOpenDropDown[idx] ? (
<DropDownIconWrapper>
<DropUpIc />{' '}
</DropDownIconWrapper>
) : (
<DropDownIconWrapper>
<DropDownIc />
</DropDownIconWrapper>
)}

<DropDownIconWrapper>
{isOpenDropDown[idx] ? <DropUpIc /> : <DropDownIc />}
</DropDownIconWrapper>
{isOpenDropDown[idx] && (
<DropdownWrapper>
{Object.entries(selectedSlots).map(
{sortedSlots.map(
([key, value]) =>
!value.priority && (
<DropDownItem key={key} onClick={() => handlePriority(idx, value, key)}>
Expand Down Expand Up @@ -222,9 +192,6 @@ const TextWrapper = styled.div`
left: 50%;
transform: translate(-50%, -50%);
`;
const Circle1Icon = styled(Circle1Ic)``;
const Circle2Icon = styled(Circle2Ic)``;
const Circle3Icon = styled(Circle3Ic)``;

const InputWrapper = styled.div`
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,16 @@ import { useSelectContext } from 'pages/selectSchedule/contexts/useSelectContext
import { theme } from 'styles/theme';

import useSlotSeletion from './hooks/useSlotSelection';

import Slot from '../../../../components/common/timetableComponents/parts/Slot';

function SelectionColumn({ date, timeSlots }: ColumnStructure) {
const { selectedSlots } = useSelectContext();

const selectedSlotsPerDate = Object.entries(selectedSlots).filter(
([, slot]) => slot.date === date,
);

//test
const { startSlot, onClickSlot } = useSlotSeletion();

const getTimeSlotStyle = (slotId: string, selectedEntryId?: number) => {
Expand Down
16 changes: 14 additions & 2 deletions src/pages/selectSchedule/components/selectTimeSlot/TimeSlotCta.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,31 @@
import Button from 'components/common/atomComponents/Button';
import Text from 'components/common/atomComponents/Text';
import { useScheduleStepContext } from 'pages/selectSchedule/contexts/useScheduleStepContext';
import { useSelectContext } from 'pages/selectSchedule/contexts/useSelectContext';
import { SelectedSlotType, useSelectContext } from 'pages/selectSchedule/contexts/useSelectContext';
import styled from 'styled-components';

function TimeSlotCta() {
const { selectedSlots, setSelectedSlots } = useSelectContext();
const { setScheduleStep } = useScheduleStepContext();
const { selectedSlots } = useSelectContext();
const isValidSelection = Object.keys(selectedSlots).length !== 0;

const resetPriorities = (selectedSlots: SelectedSlotType) => {
const updatedSelectedSlots: SelectedSlotType = {};
for (const key in selectedSlots) {
updatedSelectedSlots[key] = {
...selectedSlots[key],
priority: 0,
};
}
setSelectedSlots(updatedSelectedSlots);
};
return (
<BtnDim>
<Button
typeState={isValidSelection ? 'primaryActive' : 'secondaryDisabled'}
onClick={() => {
setScheduleStep('selectPriority');
resetPriorities(selectedSlots);
}}
>
<Text font={'button2'}>다음</Text>
Expand Down
Loading