Skip to content

Commit

Permalink
refactor: 공통으로 사용하는 type, api @dnd-academy/core로 이동
Browse files Browse the repository at this point in the history
  • Loading branch information
saseungmin committed Jul 29, 2024
1 parent 589ea7a commit 17d67a4
Show file tree
Hide file tree
Showing 41 changed files with 111 additions and 100 deletions.
1 change: 1 addition & 0 deletions apps/admin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"homepage": "https://github.com/DNDACADEMY/dnd-academy-v2#readme",
"dependencies": {
"@dnd-academy/core": "*",
"@dnd-academy/ui": "*",
"@vercel/blob": "0.23.4",
"clsx": "2.1.1",
Expand Down
10 changes: 6 additions & 4 deletions apps/admin/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { redirect } from 'next/navigation';

import { api, CurrentApplicantCount } from '@dnd-academy/core';

import { auth } from '@/auth';
import SignOut from '@/components/auth/SignOut';

Expand All @@ -10,18 +12,18 @@ async function MainPage() {
redirect('/login');
}

// TODO - 제거 예정 (임시 호출 테스트)
const response = await fetch(`${process.env.NEXT_PUBLIC_VERCEL_BLOB_HOST}/current_applicant_count.json`, {
const currentApplicantCountData = await api<CurrentApplicantCount>({
url: '/current_applicant_count.json',
method: 'GET',
});

const currentApplicantCountData = await response.json();

console.log('currentApplicantCountData', currentApplicantCountData);

return (
<>
<h1>DND - AdminPage</h1>
<div>{currentApplicantCountData.designer}</div>
<div>{currentApplicantCountData.developer}</div>
<SignOut />
</>
);
Expand Down
1 change: 1 addition & 0 deletions apps/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
"homepage": "https://github.com/DNDACADEMY/dnd-academy-v2#readme",
"dependencies": {
"@channel.io/channel-web-sdk-loader": "1.1.7",
"@dnd-academy/core": "*",
"@dnd-academy/ui": "*",
"@next/third-parties": "14.2.4",
"clsx": "2.1.1",
Expand Down
44 changes: 0 additions & 44 deletions apps/web/src/app/api/index.ts

This file was deleted.

21 changes: 0 additions & 21 deletions apps/web/src/app/api/model.ts

This file was deleted.

5 changes: 2 additions & 3 deletions apps/web/src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { api, CurrentApplicantCount } from '@dnd-academy/core';

import HomePage from '@/components/pages/HomePage';
import { getEventStatus } from '@/lib/apis/event';
import { DEFAULT_METADATA } from '@/lib/constants/metadata';
import { CurrentApplicantCount } from '@/lib/types/count';
import { checkNumber } from '@/utils';

import api from './api';

export const metadata = DEFAULT_METADATA;

type ParamsKey = 'tab';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/global/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import Link from 'next/link';

import { LogoType } from '@dnd-academy/core';
import { Button } from '@dnd-academy/ui';

import ExternalLink from '@/components/atoms/ExternalLink';
import SocialIconLink from '@/components/molecules/SocialIconLink';
import ApplyNotifyButtonGroup from '@/components/organisms/ApplyNotifyButtonGroup';
import { getEventStatus } from '@/lib/apis/event';
import { LogoType } from '@/lib/types/common';

import styles from './index.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/molecules/SocialIconLink/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { FunctionComponent, SVGAttributes } from 'react';

import { LogoType } from '@dnd-academy/core';
import clsx from 'clsx';

import ExternalLink from '@/components/atoms/ExternalLink';
Expand All @@ -19,7 +20,6 @@ import {
VelogLogo,
YoutubeLogo,
} from '@/lib/assets/logos';
import { LogoType } from '@/lib/types/common';

import styles from './index.module.scss';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

import { cloneElement, ReactElement } from 'react';

import { ButtonProps } from '@dnd-academy/ui';
import type { EventStatus } from '@dnd-academy/core';
import type { ButtonProps } from '@dnd-academy/ui';

import useCountdown from '@/hooks/useCountdown';
import { CURRENT_FLAG, NEXT_COHORT_NOTIFICATION_URL, NEXT_FLAG } from '@/lib/constants';
import { EventStatus } from '@/lib/types/event';

import ApplyModal from '../ApplyModal';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/organisms/EventStatus/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

import 'dayjs/locale/ko';

import type { EventStatus as Event } from '@dnd-academy/core';
import { Badge } from '@dnd-academy/ui';
import dayjs from 'dayjs';
import relativeTime from 'dayjs/plugin/relativeTime';

import useCountdown from '@/hooks/useCountdown';
import useCurrentTime from '@/hooks/useCurrentTime';
import { CURRENT_FLAG } from '@/lib/constants';
import { EventStatus as Event } from '@/lib/types/event';

dayjs.extend(relativeTime);
dayjs.locale('ko');
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/organisms/JobCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import Image from 'next/image';

import type { Job } from '@dnd-academy/core';

import ExternalLink from '@/components/atoms/ExternalLink';
import { Job } from '@/lib/types/job';

import styles from './index.module.scss';

Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/organisms/OrganizerCards/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import Image from 'next/image';
import Link from 'next/link';

import type { Organizer } from '@dnd-academy/core';
import { SkillTag } from '@dnd-academy/ui';

import { Organizer } from '@/lib/types/organizer';

import styles from './index.module.scss';

type Props = {
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/components/organisms/ProjectCards/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import Image from 'next/image';
import Link from 'next/link';

import type { Project } from '@dnd-academy/core';
import { SkillTag } from '@dnd-academy/ui';

import { Project } from '@/lib/types/project';

import styles from './index.module.scss';

type Props = {
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/organisms/ReviewList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Link from 'next/link';

import type { Review } from '@dnd-academy/core';
import clsx from 'clsx';

import ResponsiveMasonry from '@/components/atoms/ResponsiveMasonry';
import SocialIconLink from '@/components/molecules/SocialIconLink';
import { RightArrowIcon } from '@/lib/assets/icons';
import { Review } from '@/lib/types/review';
import { getEntries } from '@/utils';

import styles from './index.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/pages/HomePage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from 'next/image';

import type { EventStatus as Event } from '@dnd-academy/core';
import { Button, Counter } from '@dnd-academy/ui';

import ScrollElement from '@/components/atoms/ScrollElement';
Expand All @@ -14,7 +15,6 @@ import ShareAlarmSection from '@/components/organisms/ShareAlarmSection';
import SponsorSection from '@/components/organisms/SponsorSection';
import { faqData } from '@/lib/assets/data';
import { RightArrowIcon } from '@/lib/assets/icons';
import type { EventStatus as Event } from '@/lib/types/event';

import styles from './index.module.scss';

Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/pages/JobsPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Job } from '@dnd-academy/core';

import Tags from '@/components/molecules/Tags';
import JobCard from '@/components/organisms/JobCard';
import { getJobCount } from '@/lib/apis/job';
import { Job } from '@/lib/types/job';

import styles from './index.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/pages/OrganizerPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from 'next/image';

import type { Organizer } from '@dnd-academy/core';
import { Button, SkillTag } from '@dnd-academy/ui';

import DetailNavigation from '@/components/molecules/DetailNavigation';
Expand All @@ -10,7 +11,6 @@ import OrganizerCards from '@/components/organisms/OrganizerCards';
import { getEventStatus } from '@/lib/apis/event';
import { getOrganizers } from '@/lib/apis/organizer';
import { RightArrowIcon } from '@/lib/assets/icons';
import { Organizer } from '@/lib/types/organizer';
import { getEntries } from '@/utils';

import styles from './index.module.scss';
Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/pages/OrganizersPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Organizer } from '@dnd-academy/core';
import { Button } from '@dnd-academy/ui';

import Tags from '@/components/molecules/Tags';
import OrganizerCards from '@/components/organisms/OrganizerCards';
import { getOrganizerCount, getOrganizers } from '@/lib/apis/organizer';
import { Organizer } from '@/lib/types/organizer';

import styles from './index.module.scss';

Expand Down
2 changes: 1 addition & 1 deletion apps/web/src/components/pages/ProjectPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Image from 'next/image';

import type { Project } from '@dnd-academy/core';
import { Badge, Button, SkillTag } from '@dnd-academy/ui';

import DetailNavigation from '@/components/molecules/DetailNavigation';
Expand All @@ -11,7 +12,6 @@ import ReviewList from '@/components/organisms/ReviewList';
import { getProjects } from '@/lib/apis/project';
import { getReviews } from '@/lib/apis/review';
import { ShareIcon } from '@/lib/assets/icons';
import { Project } from '@/lib/types/project';
import { getEntries } from '@/utils';

import styles from './index.module.scss';
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/pages/ProjectsPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Project } from '@dnd-academy/core';

import Tags from '@/components/molecules/Tags';
import ProjectCards from '@/components/organisms/ProjectCards';
import { getProjectCount } from '@/lib/apis/project';
import { Project } from '@/lib/types/project';

type Props = {
projects: Project[];
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/components/pages/ReviewsPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import type { Review } from '@dnd-academy/core';

import Tags from '@/components/molecules/Tags';
import ReviewList from '@/components/organisms/ReviewList';
import { getReviewCount } from '@/lib/apis/review';
import { Review } from '@/lib/types/review';

type Props = {
reviews: Review[];
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/apis/event.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { EventStatus } from '@dnd-academy/core';

import { eventStatusData } from '../assets/data';
import { EventStatus } from '../types/event';

// eslint-disable-next-line import/prefer-default-export
export const getEventStatus = () => eventStatusData as EventStatus;
3 changes: 2 additions & 1 deletion apps/web/src/lib/apis/job.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { Job } from '@dnd-academy/core';

import { jobsData } from '@/lib/assets/data';
import { Job } from '@/lib/types/job';
import { checkNumber } from '@/utils';

export function getJobs({ flag }: { flag?: string; } | undefined = {}): Job[] {
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/apis/organizer.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Organizer, OrganizerPosition } from '@dnd-academy/core';

import { organizersData } from '@/lib/assets/data';
import { Organizer, OrganizerPosition } from '@/lib/types/organizer';
import { checkNumber } from '@/utils';

export function getOrganizers({
Expand Down
3 changes: 2 additions & 1 deletion apps/web/src/lib/apis/project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type { Project, ProjectFlag } from '@dnd-academy/core';

import { projectsData } from '@/lib/assets/data';
import { Project, ProjectFlag } from '@/lib/types/project';
import { checkNumber, sortFlagsDescending } from '@/utils';

export function getProjects({
Expand Down
4 changes: 2 additions & 2 deletions apps/web/src/lib/apis/review.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { ProjectFlag, Review, ReviewPosition } from '@dnd-academy/core';

import { reviewsData } from '@/lib/assets/data';
import { ProjectFlag } from '@/lib/types/project';
import { Review, ReviewPosition } from '@/lib/types/review';
import { checkNumber, sortFlagsDescending } from '@/utils';

export function getReviews({
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/utils/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import type { Entries, RequiredNonNullableObject } from '@dnd-academy/core';
import dayjs from 'dayjs';
import qs from 'qs';

import { Entries, RequiredNonNullableObject } from '@/lib/types';

const CACHE_MINUTE = 5;

export const paramsSerializer = <T>(params: T): string => qs.stringify(params, {
Expand Down
12 changes: 12 additions & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,18 @@
"files": [
"dist"
],
"exports": {
".": {
"import": "./dist/index.mjs",
"require": "./dist/index.js",
"types": "./dist/index.d.ts"
}
},
"scripts": {
"dev": "vite",
"build": "vite build",
"lint": "eslint \"**/*.ts*\""
},
"license": "GPL-3.0-only",
"author": "dnd-academy",
"devDependencies": {
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 17d67a4

Please sign in to comment.