Skip to content

Commit eecb8e3

Browse files
authored
Merge branch 'dev' into 127--ui--calendarmain
2 parents 4d552ad + 584d026 commit eecb8e3

35 files changed

+767
-89
lines changed

β€Žsrc/App.tsxβ€Ž

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import { Calendar } from './components/common/Calendar.tsx';
1+
import MyCalendarPage from './pages/MyCalendarPage';
22

33
function App() {
4+
45
return (
56
<div>
67
<header className="relative z-10">
@@ -52,6 +53,7 @@ function App() {
5253
</main>
5354
</div>
5455
);
56+
5557
}
5658

5759
export default App;
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
import supabase from '@/supabase';
2+
import { Events } from '@/utils/index';
3+
4+
export const getPersonalSchedule = async () => {
5+
const { data, error } = await supabase.from('personal_schedules').select();
6+
if (error) {
7+
throw error;
8+
}
9+
return data;
10+
};
11+
12+
// κ°€μž₯ 졜근 데이터 ν•˜λ‚˜ κ°€μ Έμ˜€κΈ°
13+
export const getLastPersonalSchedule = async () => {
14+
const { data, error } = await supabase
15+
.from('personal_schedules')
16+
.select()
17+
.order('created_at', { ascending: false })
18+
.limit(1)
19+
.maybeSingle();
20+
if (error) {
21+
throw error;
22+
}
23+
return data;
24+
};
25+
26+
export const addPersonalSchedule = async ({ start, end, ...props }: Events) => {
27+
const { error } = await supabase.from('personal_schedules').insert({ ...props, start_date: start, end_date: end });
28+
if (error) {
29+
throw error;
30+
}
31+
};
32+
33+
export const updatePersonalSchedule = async (id: number, { start, end, ...props }: Events) => {
34+
const { error } = await supabase
35+
.from('personal_schedules')
36+
.update({ ...props, start_date: start, end_date: end })
37+
.eq('id', id);
38+
if (error) {
39+
throw error;
40+
}
41+
};
42+
43+
export const deletePersonalSchedule = async (id: number) => {
44+
const { error } = await supabase.from('personal_schedules').delete().eq('id', id);
45+
if (error) {
46+
throw error;
47+
}
48+
};
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { FC } from 'react';
2+
3+
interface Props {
4+
style: string;
5+
}
6+
7+
const IconClose: FC<Props> = ({ style }) => {
8+
return (
9+
<svg
10+
xmlns="http://www.w3.org/2000/svg"
11+
fill="none"
12+
viewBox="0 0 24 24"
13+
strokeWidth="1.5"
14+
stroke="currentColor"
15+
className={`h-6 w-6 ${style}`}
16+
>
17+
<path strokeLinecap="round" strokeLinejoin="round" d="M6 18 18 6M6 6l12 12" />
18+
</svg>
19+
);
20+
};
21+
22+
export default IconClose;
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
const IconLeaf = () => {
2+
return (
3+
<svg width="46" height="48" viewBox="0 0 46 48" fill="none" xmlns="http://www.w3.org/2000/svg">
4+
<path
5+
d="M38.3476 42.3332C35.985 42.3332 33.3148 42.3332 30.3858 42.5167C22.9579 42.9754 12.9085 42.165 10.8371 32.1346C7.89185 17.8842 16.4363 6.20248 15.5463 9.04646C8.2155 32.3946 21.7118 37.9143 32.6028 40.7736C35.8879 41.6298 37.7327 41.8286 40.6294 37.5626C44.3514 32.1041 47.7012 21.9055 45.0472 16.9209C39.529 6.66119 19.0093 5.42268 20.2392 1.06498C21.6471 -3.88904 -1.12189 8.74065 0.0432616 32.7004C0.706751 46.3392 13.5234 52.1648 36.082 44.7643C38.3638 44.0151 38.3476 42.3485 38.3476 42.3485V42.3332Z"
6+
fill="#B8EA00"
7+
/>
8+
</svg>
9+
);
10+
};
11+
12+
export default IconLeaf;

β€Žsrc/assets/icons/index.tsxβ€Ž

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import IconClose from './IconClose';
2+
import IconLeaf from './IconLeaf';
3+
import IconPlus from './IconPlus';
4+
import IconSearch from './IconSearch';
5+
import IconUserPlus from './IconUserPlus';
6+
7+
export { IconClose, IconLeaf, IconPlus, IconSearch, IconUserPlus };
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { FC } from 'react';
2+
import GroupFormNameInput from './GroupFormNameInput';
3+
import GroupFormDescriptionInput from './GroupFormDescriptionInput';
4+
import GroupFormDateInput from './GroupFormDateInput';
5+
import UserInvite from '../common/UserInvite';
6+
import GroupFormMemoInput from './GroupFormMemoInput';
7+
8+
interface Props {
9+
name?: string;
10+
description?: string;
11+
startDate?: string;
12+
endDate?: string;
13+
memo?: string;
14+
onSubmit: React.FormEventHandler<HTMLFormElement>;
15+
}
16+
17+
const GroupForm: FC<Props> = ({
18+
name = '',
19+
description = '',
20+
startDate = new Date().toString(),
21+
endDate = new Date().toString(),
22+
memo = '',
23+
onSubmit,
24+
}) => {
25+
return (
26+
<form onSubmit={onSubmit} className="container mx-auto flex max-w-sm flex-1 flex-col gap-4 pb-[50px] pt-4">
27+
<div className="flex h-full w-full flex-1 flex-col gap-4">
28+
<GroupFormNameInput name={name} />
29+
<GroupFormDescriptionInput description={description} />
30+
<GroupFormDateInput startDate={startDate} endDate={endDate} />
31+
<UserInvite />
32+
<GroupFormMemoInput memo={memo} />
33+
</div>
34+
<button type="submit" className="btn btn-outline btn-primary w-full">
35+
μ €μž₯
36+
</button>
37+
</form>
38+
);
39+
};
40+
41+
export default GroupForm;
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import { FC } from 'react';
2+
import { dateToYYMMDD } from '@/utils/dateUtils';
3+
4+
interface Props {
5+
startDate: string;
6+
endDate: string;
7+
}
8+
9+
const GroupFormDateInput: FC<Props> = ({ startDate, endDate }) => {
10+
return (
11+
<div className="w-full">
12+
<label className="label label-text w-full text-start">λͺ¨μž„ μ„€μ • κΈ°κ°„ *</label>
13+
<div className="input input-bordered flex w-full flex-row items-center gap-1 p-0">
14+
<label className="hidden" htmlFor="group-start-date-input">
15+
λͺ¨μž„ μ‹œμž‘
16+
</label>
17+
<input
18+
className="input border-none"
19+
type="date"
20+
defaultValue={dateToYYMMDD(new Date(startDate))}
21+
id="group-start-date-input"
22+
name="startDate"
23+
/>
24+
~
25+
<label className="hidden" htmlFor="group-end-date-input">
26+
λͺ¨μž„ μ’…λ£Œ
27+
</label>
28+
<input
29+
className="input border-none"
30+
type="date"
31+
id="group-end-date-input"
32+
defaultValue={dateToYYMMDD(new Date(endDate))}
33+
name="endDate"
34+
/>
35+
</div>
36+
</div>
37+
);
38+
};
39+
40+
export default GroupFormDateInput;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from 'react';
2+
import InputForm from '../common/InputForm';
3+
4+
interface Props {
5+
description: string;
6+
}
7+
8+
const GroupFormDescriptionInput: FC<Props> = ({ description }) => {
9+
return (
10+
<InputForm
11+
id="group-description-input"
12+
type="text"
13+
defaultValue={description}
14+
placeholder="λͺ¨μž„ μ„€λͺ…을 μž…λ ₯ν•˜μ„Έμš”"
15+
onChange={() => {}}
16+
title="λͺ¨μž„ μ„€λͺ…"
17+
hint=""
18+
name="description"
19+
/>
20+
);
21+
};
22+
23+
export default GroupFormDescriptionInput;
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { FC } from 'react';
2+
3+
interface Props {
4+
memo: string;
5+
}
6+
7+
const GroupFormMemoInput: FC<Props> = ({ memo }) => {
8+
return (
9+
<div>
10+
<label className="label label-text w-full text-start">λ©”λͺ¨</label>
11+
<textarea
12+
id="group-memo-input"
13+
className="input input-bordered h-24 w-full"
14+
rows={10}
15+
placeholder="λ©”λͺ¨λ₯Ό μž…λ ₯ν•˜μ„Έμš”"
16+
defaultValue={memo}
17+
onChange={() => {}}
18+
title="λ©”λͺ¨"
19+
name="memo"
20+
/>
21+
<p className="label-text-alt">μ΅œλŒ€ 500자 κΉŒμ§€ μž…λ ₯ν•  수 μžˆμŠ΅λ‹ˆλ‹€.</p>
22+
</div>
23+
);
24+
};
25+
26+
export default GroupFormMemoInput;
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import { FC } from 'react';
2+
import InputForm from '../common/InputForm';
3+
4+
interface Props {
5+
name: string;
6+
}
7+
8+
const GroupFormNameInput: FC<Props> = ({ name = '' }) => {
9+
return (
10+
<InputForm
11+
id="group-name-input"
12+
type="text"
13+
defaultValue={name}
14+
placeholder="λͺ¨μž„λͺ…을 μž…λ ₯ν•˜μ„Έμš”"
15+
onChange={() => {}}
16+
title="λͺ¨μž„λͺ… *"
17+
hint=""
18+
name="name"
19+
/>
20+
);
21+
};
22+
23+
export default GroupFormNameInput;

0 commit comments

Comments
Β (0)