Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 0 additions & 2 deletions .github/workflows/deploy-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ jobs:
node-version: '20.11.1'

- name: Build & Export
env:
VITE_API_BASE_URL: ${{ secrets.VITE_API_BASE_URL }}
run: |
yarn install
yarn build
Expand Down
34 changes: 34 additions & 0 deletions .github/workflows/deploy-temp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: deploy-temp

on:
push:
branches:
- revert-api
workflow_dispatch:

jobs:
deploy:
name: Deploy
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '20.11.1'

- name: Build & Export
run: |
yarn install
yarn build

- name: Deploy to S3 and Invalidate Cloudfront
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ap-northeast-2
run: |
aws s3 sync ./dist s3://waffle-team4-web-temp --delete
aws cloudfront create-invalidation --distribution-id E2HDLBJVBNM8HH --paths "/*"
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>๋ชจ์ด์ƒค dev</title>
<title>๋ชจ์ด์ƒค Alpha</title>
</head>
<body>
<div id="root"></div>
Expand Down
3 changes: 1 addition & 2 deletions src/api/apiClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@ import useAuthStore from '../hooks/useAuthStore';

// ๊ณตํ†ต ์„ค์ •์„ ๊ฐ€์ง„ axios ์ธ์Šคํ„ด์Šค ์ƒ์„ฑ
const apiClient = axios.create({
baseURL: `{import.meta.env.VITE_API_BASE_URL}/api/v1`,
baseURL: '/api', // ๋ชจ๋“  ์š”์ฒญ์˜ ๊ธฐ๋ณธ ๊ฒฝ๋กœ
timeout: 5000,
headers: { 'Content-Type': 'application/json' },
});

// ์š”์ฒญ ์ธํ„ฐ์…‰ํ„ฐ: ๋ชจ๋“  ์š”์ฒญ ์ง์ „์— ์‹คํ–‰๋จ
Expand Down
10 changes: 4 additions & 6 deletions src/api/auth/login.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import apiClient from '@/api/apiClient';
import type { LoginRequest, LoginResponse } from '@/types/auth';
import type { AuthResponse, LoginRequest } from '../../types/auth';
import apiClient from '../apiClient';

export default async function login(
data: LoginRequest
): Promise<LoginResponse> {
const response = await apiClient.post<LoginResponse>('/auth/login', data);
export default async function login(data: LoginRequest): Promise<AuthResponse> {
const response = await apiClient.post<AuthResponse>('/auth/login', data);
return response.data;
}
7 changes: 0 additions & 7 deletions src/api/auth/logout.ts

This file was deleted.

7 changes: 7 additions & 0 deletions src/api/auth/me.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { User, UserGroup } from '../../types/auth';
import apiClient from '../apiClient';

export default async function getMe(): Promise<User & { groups: UserGroup[] }> {
const response = await apiClient.get('/auth/me');
return response.data;
}
20 changes: 8 additions & 12 deletions src/api/auth/signup.ts
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
import apiClient from '@/api/apiClient';
import type { SignUpRequest, SignUpResponse } from '@/types/auth';
import type { AuthResponse, SignUpRequest } from '../../types/auth';
import apiClient from '../apiClient';

export default async function signup(
data: SignUpRequest
): Promise<SignUpResponse> {
): Promise<AuthResponse> {
const formData = new FormData();

formData.append('email', data.email);
formData.append('name', data.name);
formData.append('username', data.username);
formData.append('password', data.password);
formData.append('name', data.name);

if (data.profileImage) {
formData.append('profileImage', data.profileImage);
if (data.photo) {
formData.append('photo', data.photo); // ๋ฐฑ์—”๋“œ ํ•„๋“œ๋ช…๊ณผ 'photo' ์ผ์น˜์‹œํ‚ค๊ธฐ
}

const response = await apiClient.post<SignUpResponse>(
'/auth/signup',
formData
);

const response = await apiClient.post<AuthResponse>('/auth/signup', formData);
return response.data;
}
9 changes: 3 additions & 6 deletions src/api/auth/social.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import type { SocialLoginRequest, SocialLoginResponse } from '../../types/auth';
import type { AuthResponse, SocialLoginRequest } from '../../types/auth';
import apiClient from '../apiClient';

export default async function social(
data: SocialLoginRequest
): Promise<SocialLoginResponse> {
const response = await apiClient.post<SocialLoginResponse>(
'/auth/social',
data
);
): Promise<AuthResponse> {
const response = await apiClient.post<AuthResponse>('/auth/social', data);
return response.data;
}
50 changes: 0 additions & 50 deletions src/api/event.ts

This file was deleted.

7 changes: 0 additions & 7 deletions src/api/users/me.ts

This file was deleted.

23 changes: 14 additions & 9 deletions src/components/EventCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,31 @@ import {
ItemMedia,
ItemTitle,
} from '@/components/ui/item';
import type { Event } from '@/types/schemas';
import type { Events } from '@/types/schema';
import { getShortenedDate } from '@/utils/date';
import { ChevronRightIcon, Plus } from 'lucide-react';
import { Link } from 'react-router';
import { Button } from './ui/button';

type Event = Events & { guests: number; registration_start: string | null };

function getDateLabel(
startEpoch: number | undefined,
endEpoch: number | undefined
startDateString: string | null,
endDateString: string | null
) {
if (!endEpoch) {
if (!endDateString) {
return '์ƒ์‹œ ๋ชจ์ง‘ ์ค‘';
}

const now = new Date();
const endDate = new Date(endEpoch);
const endDate = new Date(endDateString!);

if (startEpoch && now < new Date(startEpoch)) {
return `${getShortenedDate(startEpoch)}๋ถ€ํ„ฐ ๋ชจ์ง‘`;
if (startDateString && now < new Date(startDateString)) {
return `${getShortenedDate(startDateString)}๋ถ€ํ„ฐ ๋ชจ์ง‘`;
}

if (now <= endDate) {
return `${getShortenedDate(endEpoch)}๊นŒ์ง€ ๋ชจ์ง‘`;
return `${getShortenedDate(endDateString)}๊นŒ์ง€ ๋ชจ์ง‘`;
}

return '๋ชจ์ง‘ ๋งˆ๊ฐ';
Expand Down Expand Up @@ -82,7 +84,10 @@ export default function EventCardView({ events }: { events: Event[] }) {
</h2>
</ItemTitle>
<ItemDescription>
{getDateLabel(undefined, event.registrationDeadline)}
{getDateLabel(
event.registration_start,
event.registration_deadline
)}
</ItemDescription>
</ItemContent>
<ItemActions>
Expand Down
22 changes: 9 additions & 13 deletions src/components/EventDetailContent.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { ScrollArea } from '@/components/ui/scroll-area';
import type { Event } from '@/types/schemas';
import { useNavigate } from 'react-router';
import type { Events } from '../types/schema';
import { formatEventDate } from '../utils/date';

interface EventDetailContentProps {
schedule: Event;
currentParticipants: number;
interface Props {
schedule: Events;
}

// ์•„์ด์ฝ˜
Expand All @@ -24,18 +23,15 @@ const IconChevronLeft = () => (
</svg>
);

export default function EventDetailContent({
schedule,
currentParticipants,
}: EventDetailContentProps) {
export default function EventDetailContent({ schedule }: Props) {
const navigate = useNavigate();

return (
<div className="w-full flex flex-col items-start gap-10">
{/* 1. ์ผ์‹œ ๋ฐ ์žฅ์†Œ */}
<div className="text-left space-y-3 w-full">
<p className="text-lg sm:text-xl font-bold text-black">
์ผ์‹œ {formatEventDate(schedule.startAt)}
์ผ์‹œ {formatEventDate(schedule.start_at)}
</p>
<p className="text-lg sm:text-xl font-bold text-black">
์žฅ์†Œ {schedule.location || '๋ฏธ์ •'}
Expand All @@ -44,12 +40,12 @@ export default function EventDetailContent({

{/* 2. ์‹ ์ฒญ ํ˜„ํ™ฉ ๋ฒ„ํŠผ */}
<button
onClick={() => navigate(`/event/${schedule.id}/guests`)}
onClick={() => navigate('guests')}
className="flex items-center text-lg font-bold group hover:opacity-70 transition-opacity"
>
{schedule.capacity}๋ช… ์ค‘{' '}
<span className="text-black ml-2 font-extrabold">
{currentParticipants}๋ช… ์‹ ์ฒญ
{/* ์‹ ์ฒญ ์ธ์› ํ•„๋“œ ํ•„์š” */}8๋ช… ์‹ ์ฒญ
</span>
<div className="rotate-180 ml-2 group-hover:translate-x-1 transition-transform text-black">
<IconChevronLeft />
Expand All @@ -65,8 +61,8 @@ export default function EventDetailContent({

{/* 4. ๋งˆ๊ฐ ์ •๋ณด (๋ฒ„ํŠผ ์ƒ๋‹จ ๋ฌธ๊ตฌ) */}
<p className="text-lg font-bold text-black">
{schedule.registrationDeadline
? `${formatEventDate(schedule.registrationDeadline)} ๋ชจ์ง‘ ๋งˆ๊ฐ`
{schedule.registration_deadline
? `${formatEventDate(schedule.registration_deadline)} ๋ชจ์ง‘ ๋งˆ๊ฐ`
: '์ƒ์‹œ ๋ชจ์ง‘'}
</p>
</div>
Expand Down
12 changes: 8 additions & 4 deletions src/components/GuestSummaryList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar';
import { Button } from '@/components/ui/button';
import type { Guest } from '@/types/schemas';
import { useNavigate } from 'react-router';

interface Guest {
name: string;
img?: string;
}

interface Props {
guests: Guest[];
totalCount: number;
Expand Down Expand Up @@ -38,13 +42,13 @@ export default function GuestSummaryList({
{guests.map((p, idx) => (
<div key={idx} className="flex flex-col items-center gap-4">
<Avatar className="w-16 h-16 border-none">
<AvatarImage src={p.guestEmail ?? undefined} />
<AvatarImage src={p.img} />
<AvatarFallback className="bg-black text-white text-xs">
{p.guestName?.slice(0, 2)}
{p.name.slice(0, 2)}
</AvatarFallback>
</Avatar>
<span className="text-sm font-bold text-gray-700 truncate w-full text-center">
{p.guestName}
{p.name}
</span>
</div>
))}
Expand Down
15 changes: 12 additions & 3 deletions src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,17 @@ import ProfileButton from '@/components/ProfileButton';
import useAuth from '@/hooks/useAuth';
import { Link, NavLink } from 'react-router';

const userExample = {
id: 1,
email: 'user@example.com',
name: '๋ฐ•์ค€์˜',
profileImage: 'https://github.com/shadcn.png',
createdAt: '2023-01-01T00:00:00.000Z',
updatedAt: '2023-01-01T00:00:00.000Z',
};

export default function Header() {
const { user, isLoggedIn, handleLogout } = useAuth();
const { isLoggedIn, handleLogout } = useAuth();

const linkClassName = (isActive: boolean) => `
h-[42px] items-center px-4 py-2 rounded-md text-black font-semibold
Expand All @@ -17,7 +26,7 @@ export default function Header() {
๋ชจ์ด์ƒค
</Link>
<div className="items-center space-x-2">
{!isLoggedIn || !user ? (
{!isLoggedIn ? (
<>
<NavLink
to="/login"
Expand All @@ -33,7 +42,7 @@ export default function Header() {
</NavLink>
</>
) : (
<ProfileButton user={user} handleLogout={handleLogout} />
<ProfileButton user={userExample} handleLogout={handleLogout} />
)}
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/components/ProfileButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
DropdownMenuSeparator,
DropdownMenuTrigger,
} from '@/components/ui/dropdown-menu';
import type { User } from '@/types/schemas';
import type { User } from '@/types/auth';

interface ProfileButtonProps {
user: User;
Expand Down
Loading