Skip to content

Commit

Permalink
refactor(constants): 체계 정리, 파일 네이밍 컨벤션 camelCase (#275)
Browse files Browse the repository at this point in the history
* refactor(constants): 체계 정리, 파일 네이밍 컨벤션 camelCase

* refactor(constants): tmp 제거

파일명의 대소문자 변화는 git에서 인식하지 못합니다.
  • Loading branch information
yoopark authored and 김성욱 committed Oct 18, 2023
1 parent a315743 commit 42c9bd0
Show file tree
Hide file tree
Showing 76 changed files with 198 additions and 189 deletions.
2 changes: 1 addition & 1 deletion app/src/@core/AppRoutes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { ProfileVersusPageSkeleton } from '@/Profile/components/skeletons/Profil
import { UserProfileSkeleton } from '@/Profile/components/skeletons/UserProfileSkeleton';
import { AuthGuard } from '@core/guards/AuthGuard';
import { UnAuthGuard } from '@core/guards/UnAuthGuard';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { DeferredComponent } from '@shared/ui-kit';
import { Suspense, lazy } from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';
Expand Down
4 changes: 2 additions & 2 deletions app/src/@core/components/Footer/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ReactComponent as GithubLogo } from '@shared/assets/logo/github-logo.svg';
import { ARIA_LABEL_LINK } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { CaptionText, HStack } from '@shared/ui-kit';
import { Link } from 'react-router-dom';

Expand All @@ -18,7 +18,7 @@ export const Footer = () => {
to="https://github.com/orgs/42Statistics/repositories"
target="_blank"
rel="noreferrer"
aria-label={ARIA_LABEL_LINK.STAT_GITHUB}
aria-label={ARIA_LABEL.LINK.STAT_GITHUB}
>
<GithubLogo width={16} height={16} fill={theme.colors.mono.gray500} />
</Link>
Expand Down
2 changes: 1 addition & 1 deletion app/src/@core/components/Header/Mobile/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SearchBarShapeButton } from '@core/components/SearchBarShapeButton';
import styled from '@emotion/styled';
import { AppLogoTitle } from '@shared/components/AppLogoTitle';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { VStack } from '@shared/ui-kit';
import { Link } from 'react-router-dom';

Expand Down
2 changes: 1 addition & 1 deletion app/src/@core/components/Modal/ReLoginDialog.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { reLoginDialogInfoAtom } from '@core/atoms/reLoginDialogInfoAtom';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { AlertDialog } from '@shared/ui-kit';
import { clearStorage } from '@shared/utils/storage/clearStorage';
import { useAtom } from 'jotai';
Expand Down
6 changes: 3 additions & 3 deletions app/src/@core/components/NavBar/Desktop/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import { SearchBarShapeButton } from '@core/components/SearchBarShapeButton';
import styled from '@emotion/styled';
import { userAtom } from '@shared/atoms/userAtom';
import { AppLogoTitle } from '@shared/components/AppLogoTitle';
import { ROUTES } from '@shared/constants/ROUTES';
import { ARIA_LABEL_LINK } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import { VStack } from '@shared/ui-kit';
import { useAtomValue } from 'jotai';
import { Link } from 'react-router-dom';
Expand All @@ -20,7 +20,7 @@ export const DesktopNavBar = ({ fixed = true }: DesktopNavBarProps) => {
return (
<Layout fixed={fixed}>
<VStack w="100%" h="100%" spacing="4rem">
<Link to={ROUTES.HOME} aria-label={ARIA_LABEL_LINK.STAT}>
<Link to={ROUTES.HOME} aria-label={ARIA_LABEL.LINK.STAT}>
<AppLogoTitle size="sm" />
</Link>
<DesktopNavProfile
Expand Down
4 changes: 2 additions & 2 deletions app/src/@core/components/NavBar/Tablet/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ReactComponent as MdSearch } from '@shared/assets/icon/md-search.svg';
import { userAtom } from '@shared/atoms/userAtom';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { Center, Clickable, VStack } from '@shared/ui-kit';
import { useAtomValue, useSetAtom } from 'jotai';
import { TabletNavDrawer } from './TabletNavDrawer';
Expand All @@ -28,7 +28,7 @@ export const TabletNavBar = () => {
</Center>
<Clickable
onClick={openSpotlight}
aria-label={ARIA_LABEL_BUTTON.SEARCH_USER_OR_PROJECT_USING_SPOTLIGHT}
aria-label={ARIA_LABEL.BUTTON.SEARCH_USER_OR_PROJECT_USING_SPOTLIGHT}
>
<MdSearch width={20} height={20} fill={theme.colors.mono.black} />
</Clickable>
Expand Down
2 changes: 1 addition & 1 deletion app/src/@core/components/NavBar/hooks/useNavRoutes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { ReactComponent as MdQuickReference } from '@shared/assets/icon/md-quick
import { ReactComponent as MdSettingsFill } from '@shared/assets/icon/md-settings-fill.svg';
import { ReactComponent as MdSettings } from '@shared/assets/icon/md-settings.svg';
import { userAtom } from '@shared/atoms/userAtom';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import type { SvgElement } from '@shared/types/SvgElement';
import { useAtomValue } from 'jotai';

Expand Down
7 changes: 3 additions & 4 deletions app/src/@core/components/NavProfile/Desktop/index.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { userAtom } from '@shared/atoms/userAtom';
import { ALT } from '@shared/constants/accessibility/ALT';
import { ARIA_LABEL_LINK } from '@shared/constants/accessibility/ARIA_LABEL';
import { ROUTES } from '@shared/constants/ROUTES';
import { ALT, ARIA_LABEL } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import {
Avatar,
CaptionText,
Expand Down Expand Up @@ -33,7 +32,7 @@ export const DesktopNavProfile = ({
<Link
to={ROUTES.PROFILE_OF(user.login)}
style={{ width: '100%' }}
aria-label={ARIA_LABEL_LINK.PROFILE_OF(user.login)}
aria-label={ARIA_LABEL.LINK.PROFILE_OF(user.login)}
>
<Layout>
<HStack w="100%" spacing="2rem">
Expand Down
4 changes: 2 additions & 2 deletions app/src/@core/components/NavProfile/Tablet/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { userAtom } from '@shared/atoms/userAtom';
import { ROUTES } from '@shared/constants/ROUTES';
import { ALT } from '@shared/constants/accessibility/ALT';
import { ALT } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import { Avatar } from '@shared/ui-kit';
import { useAtomValue } from 'jotai';
import { Link } from 'react-router-dom';
Expand Down
4 changes: 2 additions & 2 deletions app/src/@core/components/SearchBarShapeButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { isSpotlightOpenAtom } from '@core/atoms/isSpotlightOpenAtom';
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ReactComponent as MdSearch } from '@shared/assets/icon/md-search.svg';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { CaptionText, Clickable, HStack, Spacer, Text } from '@shared/ui-kit';
import { mq } from '@shared/utils/facepaint/mq';
import { detect } from 'detect-browser';
Expand All @@ -21,7 +21,7 @@ export const SearchBarShapeButton = () => {
return (
<Layout
onClick={openSpotlight}
aria-label={ARIA_LABEL_BUTTON.SEARCH_USER_OR_PROJECT_USING_SPOTLIGHT}
aria-label={ARIA_LABEL.BUTTON.SEARCH_USER_OR_PROJECT_USING_SPOTLIGHT}
>
<HStack w="100%" justify="start" spacing="1.6rem">
<MdSearch width={18} height={18} fill={theme.colors.mono.gray500} />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useTheme } from '@emotion/react';
import { ProjectPreview } from '@shared/__generated__/graphql';
import { ReactComponent as FtLogo } from '@shared/assets/logo/ft-logo.svg';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { SpotlightListItem } from './SpotlightListItem';

type SpotlightProjectListItemProps = {
Expand Down
4 changes: 2 additions & 2 deletions app/src/@core/components/Spotlight/SpotlightUserListItem.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserPreview } from '@shared/__generated__/graphql';
import { ROUTES } from '@shared/constants/ROUTES';
import { ALT } from '@shared/constants/accessibility/ALT';
import { ALT } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import { Avatar } from '@shared/ui-kit';
import { SpotlightListItem } from './SpotlightListItem';

Expand Down
2 changes: 1 addition & 1 deletion app/src/@core/guards/AuthGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAuth } from '@core/guards/hooks/useAuth';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { Navigate, Outlet } from 'react-router-dom';

export const AuthGuard = () => {
Expand Down
2 changes: 1 addition & 1 deletion app/src/@core/guards/UnAuthGuard.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useAuth } from '@core/guards/hooks/useAuth';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { Navigate, Outlet } from 'react-router-dom';

export const UnAuthGuard = () => {
Expand Down
3 changes: 2 additions & 1 deletion app/src/@shared/atoms/themePreferenceAtom.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { LOCAL_STORAGE_KEYS } from '@shared/constants/storage';
import { atomWithStorage } from 'jotai/utils';

export type ThemePreference = 'light' | 'dark' | 'system';

export const themePreferenceAtom = atomWithStorage<ThemePreference>(
'theme_preference',
LOCAL_STORAGE_KEYS.THEME_PREFERENCE,
'light',
);
2 changes: 1 addition & 1 deletion app/src/@shared/components/CoalitionMark.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import coalition_gon_mark from '@shared/assets/coalition/mark/coalition-gon-mark
import coalition_gun_mark from '@shared/assets/coalition/mark/coalition-gun-mark.svg';
import coalition_lee_mark from '@shared/assets/coalition/mark/coalition-lee-mark.svg';
import ft_logo from '@shared/assets/logo/ft-logo.svg';
import { ALT } from '@shared/constants/accessibility/ALT';
import { ALT } from '@shared/constants/accessibility';
import { Image } from '@shared/ui-kit';

type CoalitionMarkProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ProjectRank } from '@shared/__generated__/graphql';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { RankListItem } from './RankListItem';

type ProjectRankListItemProps = {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { UserRank } from '@shared/__generated__/graphql';
import { ROUTES } from '@shared/constants/ROUTES';
import { ALT } from '@shared/constants/accessibility/ALT';
import { ALT } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import { Avatar } from '@shared/ui-kit';
import { RankListItem } from './RankListItem';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { TextDefault } from './TextDefault';

type TextProjectProps = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
EvalLogHeader,
TeamEvalLogHeader,
} from '@shared/__generated__/graphql';
import { ROUTES } from '@shared/constants/ROUTES';
import { ROUTES } from '@shared/constants/routes';
import { BoldText, HStack, PrimaryBoldText, Text } from '@shared/ui-kit';
import dayjs from 'dayjs';
import { Link } from 'react-router-dom';
Expand Down
13 changes: 5 additions & 8 deletions app/src/@shared/components/LoginButton/FtLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,25 +1,22 @@
import { useTheme } from '@emotion/react';
import { ReactComponent as FtLogo } from '@shared/assets/logo/ft-logo.svg';
import {
FT_OAUTH_ENDPOINT,
FT_OAUTH_RESPONSE_TYPE,
} from '@shared/constants/FT_OAUTH';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { URL } from '@shared/constants/url';
import { LoginButton } from './LoginButton';

export const FtLoginButton = () => {
const theme = useTheme();
const params = new URLSearchParams();
params.append('client_id', import.meta.env.VITE_FT_OAUTH_CLIENT_ID);
params.append('redirect_uri', import.meta.env.VITE_FT_OAUTH_REDIRECT_URI);
params.append('response_type', FT_OAUTH_RESPONSE_TYPE);
const FT_OAUTH_URL = `${FT_OAUTH_ENDPOINT}?${params.toString()}`;
params.append('response_type', 'code');
const FT_OAUTH_URL = `${URL.FT_OAUTH_ENDPOINT}?${params.toString()}`;

return (
<LoginButton
logo={<FtLogo width={18} height={18} fill={theme.colors.mono.black} />}
text="42 계정으로 로그인"
ariaLabel={ARIA_LABEL_BUTTON.LOGIN_WITH_42_ACCOUNT}
ariaLabel={ARIA_LABEL.BUTTON.LOGIN_WITH_42_ACCOUNT}
onClick={() => {
window.location.href = FT_OAUTH_URL;
}}
Expand Down
10 changes: 5 additions & 5 deletions app/src/@shared/components/LoginButton/GoogleLoginButton.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useMutation } from '@apollo/client';
import { gql } from '@shared/__generated__';
import { ReactComponent as GoogleLogo } from '@shared/assets/logo/google-logo.svg';
import { GAPI_URL } from '@shared/constants/GAPI';
import { ROUTES } from '@shared/constants/ROUTES';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { ROUTES } from '@shared/constants/routes';
import { URL } from '@shared/constants/url';
import {
FakeGoogleWrapperType,
createFakeGoogleWrapper,
Expand Down Expand Up @@ -37,7 +37,7 @@ export const GOOGLE_LOGIN = gql(/* GraphQL */ `
`);

export const GoogleLoginButton = () => {
const status = useScript(GAPI_URL, { removeOnUnmount: true });
const status = useScript(URL.GAPI, { removeOnUnmount: true });
const [login, { data, loading, error }] = useMutation(GOOGLE_LOGIN);
const [googleButtonWrapper, setGoogleButtonWrapper] =
useState<FakeGoogleWrapperType>();
Expand Down Expand Up @@ -88,7 +88,7 @@ export const GoogleLoginButton = () => {
<LoginButton
logo={<GoogleLogo width={18} height={18} />}
text="Google 계정으로 로그인"
ariaLabel={ARIA_LABEL_BUTTON.LOGIN_WITH_GOOGLE_ACCOUNT}
ariaLabel={ARIA_LABEL.BUTTON.LOGIN_WITH_GOOGLE_ACCOUNT}
onClick={() => googleButtonWrapper?.click()}
/>
);
Expand Down
6 changes: 3 additions & 3 deletions app/src/@shared/components/Pagination/PageButton.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useTheme } from '@emotion/react';
import styled from '@emotion/styled';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { Clickable, Text } from '@shared/ui-kit';

type PageButtonProps = {
Expand Down Expand Up @@ -28,8 +28,8 @@ export const PageButton = ({
onClick={handleClick}
aria-label={
pageNumber !== currPageNumber
? ARIA_LABEL_BUTTON.PAGINATION.PAGE_OF(pageNumber)
: ARIA_LABEL_BUTTON.PAGINATION.CURRENT_PAGE_OF(pageNumber)
? ARIA_LABEL.BUTTON.PAGINATION.PAGE_OF(pageNumber)
: ARIA_LABEL.BUTTON.PAGINATION.CURRENT_PAGE_OF(pageNumber)
}
>
<Text
Expand Down
10 changes: 5 additions & 5 deletions app/src/@shared/components/Pagination/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { ReactComponent as MdChevronLeft } from '@shared/assets/icon/md-chevron-
import { ReactComponent as MdChevronRight } from '@shared/assets/icon/md-chevron-right.svg';
import { ReactComponent as MdFirstPage } from '@shared/assets/icon/md-first-page.svg';
import { ReactComponent as MdLastPage } from '@shared/assets/icon/md-last-page.svg';
import { ARIA_LABEL_BUTTON } from '@shared/constants/accessibility/ARIA_LABEL';
import { ARIA_LABEL } from '@shared/constants/accessibility';
import { Clickable, HStack } from '@shared/ui-kit';
import { PageButton } from './PageButton';

Expand Down Expand Up @@ -61,15 +61,15 @@ export const Pagination = ({
{isStartButtonDisabled ? null : (
<Clickable
onClick={handleClickStartButton}
aria-label={ARIA_LABEL_BUTTON.PAGINATION.FIRST_PAGE}
aria-label={ARIA_LABEL.BUTTON.PAGINATION.FIRST_PAGE}
>
<MdFirstPage width={16} height={16} fill={theme.colors.mono.black} />
</Clickable>
)}
{isBackButtonDisabled ? null : (
<Clickable
onClick={handleClickBackButton}
aria-label={ARIA_LABEL_BUTTON.PAGINATION.PREVIOUS_PAGE_GROUP}
aria-label={ARIA_LABEL.BUTTON.PAGINATION.PREVIOUS_PAGE_GROUP}
>
<MdChevronLeft
width={16}
Expand All @@ -91,7 +91,7 @@ export const Pagination = ({
{isForwardButtonDisabled ? null : (
<Clickable
onClick={handleClickForwardButton}
aria-label={ARIA_LABEL_BUTTON.PAGINATION.NEXT_PAGE_GROUP}
aria-label={ARIA_LABEL.BUTTON.PAGINATION.NEXT_PAGE_GROUP}
>
<MdChevronRight
width={16}
Expand All @@ -103,7 +103,7 @@ export const Pagination = ({
{isEndButtonDisabled ? null : (
<Clickable
onClick={handleClickEndButton}
aria-label={ARIA_LABEL_BUTTON.PAGINATION.LAST_PAGE}
aria-label={ARIA_LABEL.BUTTON.PAGINATION.LAST_PAGE}
>
<MdLastPage width={16} height={16} fill={theme.colors.mono.black} />
</Clickable>
Expand Down
4 changes: 0 additions & 4 deletions app/src/@shared/constants/Date.ts

This file was deleted.

2 changes: 0 additions & 2 deletions app/src/@shared/constants/FT_OAUTH.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/src/@shared/constants/GAPI.ts

This file was deleted.

1 change: 0 additions & 1 deletion app/src/@shared/constants/LOCAL_STORAGE_KEY.ts

This file was deleted.

2 changes: 0 additions & 2 deletions app/src/@shared/constants/SESSION_STORAGE_KEY.ts

This file was deleted.

33 changes: 33 additions & 0 deletions app/src/@shared/constants/accessibility.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
export const ALT = {
AVATAR_OF: (login: string) => `${login} 사진`,
COALITION_LOGO_OF: (name: string) => `코알리숑 ${name} 로고`,
LOGO_42: '42 로고',
POKEMON_OF: (name: string) => `포켓몬 ${name}`,
POKEMON_NOT_FOUND: '포켓몬을 찾을 수 없습니다',
} as const;

export const ARIA_LABEL = {
LINK: {
STAT: '42 Stat',
HOME: '홈',
STAT_GITHUB: '42 Stat 깃허브',
PROFILE_OF: (login: string) => `${login} 프로필`,
} as const,
BUTTON: {
LOGIN_WITH_42_ACCOUNT: '42 계정으로 로그인',
LOGIN_WITH_GOOGLE_ACCOUNT: '구글 계정으로 로그인',
SEARCH_USER_OR_PROJECT_USING_SPOTLIGHT:
'스포트라이트를 이용해 유저나 프로젝트 검색',
PAGINATION: {
FIRST_PAGE: '첫 페이지',
PREVIOUS_PAGE_GROUP: '이전 페이지 그룹',
NEXT_PAGE_GROUP: '다음 페이지 그룹',
LAST_PAGE: '마지막 페이지',
PAGE_OF: (page: number) => `${page} 페이지`,
CURRENT_PAGE_OF: (page: number) => `현재 ${page} 페이지`,
} as const,
SEARCH_EVAL_LOGS: '평가 로그 검색',
LINK_WITH: (provider: string) => `${provider} 계정으로 연결`,
UNLINK_WITH: (provider: string) => `${provider} 계정 연결 해제`,
} as const,
} as const;
Loading

0 comments on commit 42c9bd0

Please sign in to comment.