Skip to content

Commit

Permalink
url 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
myheyjay committed Feb 16, 2024
1 parent 9646292 commit c6de1a0
Show file tree
Hide file tree
Showing 29 changed files with 7,702 additions and 11,317 deletions.
30 changes: 29 additions & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,31 @@
{
"extends": "next/core-web-vitals"
"root": true,
"extends": [
"next/core-web-vitals",
"plugin:react/recommended",
"plugin:@typescript-eslint/recommended",
"plugin:react-hooks/recommended",
"plugin:@tanstack/eslint-plugin-query/recommended",
"plugin:prettier/recommended"
],
"settings": {
"react": {
"version": "detect"
}
},
"parser": "@typescript-eslint/parser",
"parserOptions": {
"project": ["./tsconfig.json"]
},
"plugins": ["react-refresh", "@typescript-eslint", "@emotion"],
"rules": {
"@typescript-eslint/no-unused-vars": "off",
"react/no-unknown-property": ["error", { "ignore": ["css"] }],
"react-refresh/only-export-components": [
"warn",
{ "allowConstantExport": true }
],
"@typescript-eslint/no-namespace": "off"
},
"ignorePatterns": ["dist/**/*", ".eslintrc.json"]
}
19 changes: 9 additions & 10 deletions .github/workflows/node.js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ name: Node.js CI

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

jobs:
build:

runs-on: ubuntu-latest

strategy:
Expand All @@ -20,10 +19,10 @@ jobs:
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm run build --if-present
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: 'npm'
- run: npm run build --if-present
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -33,3 +33,5 @@ yarn-error.log*
# typescript
*.tsbuildinfo
next-env.d.ts

.yarn/
7 changes: 7 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
"tabWidth": 2,
"useTabs": false,

"singleQuote": true,
"jsxSingleQuote": true
}
32 changes: 16 additions & 16 deletions component/Card.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { pallete } from "@/styles/Color";
import { BodyMedium, Headline_02, Subtitle_02 } from "@/styles/Typography";
import Image from "next/image";
import React, { forwardRef } from "react";
import { pallete } from '@/styles/Color';
import { BodyMedium, Headline_02, Subtitle_02 } from '@/styles/Typography';
import Image from 'next/image';
import React, { forwardRef } from 'react';

interface User {
id: number;
Expand All @@ -28,31 +28,31 @@ const Card = forwardRef(
return (
<div
style={{
width: "300px",
height: "80px",
display: "flex",
flexDirection: "row",
alignItems: "center",
width: '300px',
height: '80px',
display: 'flex',
flexDirection: 'row',
alignItems: 'center',
backgroundColor: pallete.white,
}}
onClick={onClick}
ref={ref as React.LegacyRef<HTMLDivElement>}
>
<Headline_02 style={{ width: "50px", marginLeft: "16px" }}>
<Headline_02 style={{ width: '50px', marginLeft: '16px' }}>
{user?.id}
</Headline_02>

<Image src={user.imageUrl} alt={"image"} width={48} height={48} />
<Image src={user.imageUrl} alt={'image'} width={48} height={48} />
<div
style={{
display: "flex",
flexDirection: "column",
display: 'flex',
flexDirection: 'column',
}}
>
<Subtitle_02 style={{ marginLeft: "12px", width: "150px" }}>
{"@" + user?.yelloId}
<Subtitle_02 style={{ marginLeft: '12px', width: '150px' }}>
{'@' + user?.yelloId}
</Subtitle_02>
<BodyMedium style={{ marginLeft: "30px" }}>{user?.name}</BodyMedium>
<BodyMedium style={{ marginLeft: '30px' }}>{user?.name}</BodyMedium>
</div>
</div>
);
Expand Down
28 changes: 14 additions & 14 deletions component/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,38 +1,38 @@
import { pallete } from "@/styles/Color";
import { BodyLarge } from "@/styles/Typography";
import { ActionList } from "@primer/react";
import Link from "next/link";
import React from "react";
import { pallete } from '@/styles/Color';
import { BodyLarge } from '@/styles/Typography';
import { ActionList } from '@primer/react';
import Link from 'next/link';
import React from 'react';

const Menu = () => {
return (
<>
<div
style={{
width: "250px",
width: '250px',
borderRight: `1px solid ${pallete.grayscales_400}`,
borderBottom: `1px solid ${pallete.grayscales_400}`,
}}
>
<ActionList>
<ActionList.Item>
<Link href="/user">
<BodyLarge>{"유저"}</BodyLarge>
<Link href='/admin/user'>
<BodyLarge>{'유저'}</BodyLarge>
</Link>
</ActionList.Item>
<ActionList.Item>
<Link href="/cooldown">
<BodyLarge>{"쿨다운"}</BodyLarge>
<Link href='/admin/cooldown'>
<BodyLarge>{'쿨다운'}</BodyLarge>
</Link>
</ActionList.Item>
<ActionList.Item>
<Link href="/question">
<BodyLarge>{"질문"}</BodyLarge>
<Link href='/admin/question'>
<BodyLarge>{'질문'}</BodyLarge>
</Link>
</ActionList.Item>
<ActionList.Item>
<Link href="/notification">
<BodyLarge>{"푸쉬 알람"}</BodyLarge>
<Link href='/admin/notification'>
<BodyLarge>{'푸쉬 알람'}</BodyLarge>
</Link>
</ActionList.Item>
</ActionList>
Expand Down
62 changes: 31 additions & 31 deletions component/TopBar.tsx
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
/* eslint-disable react-hooks/rules-of-hooks */
import { Button, Header } from "@primer/react";
import Image from "next/image";
import logo from "../public/app_icon.svg";
import { Headline_00 } from "@/styles/Typography";
import { pallete } from "@/styles/Color";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useEffect, useState } from "react";
import axios from "axios";
import { NextRouter, useRouter } from "next/router";
import { APP_STORE_URL, GOOGLE_PLAY_URL } from "@/util/string";
import { Button, Header } from '@primer/react';
import Image from 'next/image';
import logo from '../public/app_icon.svg';
import { Headline_00 } from '@/styles/Typography';
import { pallete } from '@/styles/Color';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
import { useEffect, useState } from 'react';
import axios from 'axios';
import { NextRouter, useRouter } from 'next/router';
import { APP_STORE_URL, GOOGLE_PLAY_URL } from '@/util/string';

const SERVER_URI = process.env.NEXT_PUBLIC_SERVER_URL;
const REDIRECT_URI = process.env.NEXT_PUBLIC_KAKAO_REDIRECT_URI;
Expand All @@ -21,26 +21,26 @@ const TopBar = ({ router }: { router: NextRouter }) => {

const login = () => {
if (isKakaoLogin) {
localStorage.removeItem("accessToken");
localStorage.removeItem('accessToken');
setIsKakaoLogin(false);
} else {
window.location.href = `https://kauth.kakao.com/oauth/authorize?client_id=${KAKAO_KEY}&redirect_uri=${REDIRECT_URI}&response_type=code`;
}
};

const passwordLogin = () => {
if (localStorage.getItem("accessToken")) {
localStorage.removeItem("accessToken");
if (localStorage.getItem('accessToken')) {
localStorage.removeItem('accessToken');
setIsLogin(false);
router.push(REDIRECT_URI!);
} else {
axios
.post(`${SERVER_URI}/api/v1/admin/login`, {
password: prompt("비밀 번호를 입력하세요."),
password: prompt('비밀 번호를 입력하세요.'),
})
.then((res) => {
alert("로그인에 성공하였습니다!");
localStorage.setItem("accessToken", res.data.data.accessToken);
alert('로그인에 성공하였습니다!');
localStorage.setItem('accessToken', res.data.data.accessToken);
setIsLogin(true);
})
.catch((reason) => alert(reason.response.data.message));
Expand All @@ -49,7 +49,7 @@ const TopBar = ({ router }: { router: NextRouter }) => {

useEffect(() => {
const { code } = router.query;
if (localStorage.getItem("accessToken")) {
if (localStorage.getItem('accessToken')) {
// setIsKakaoLogin(true);
setIsLogin(true);
}
Expand All @@ -58,31 +58,31 @@ const TopBar = ({ router }: { router: NextRouter }) => {
const postLogin = async (accessToken: string) => {
axios
.post(`${SERVER_URI}/api/v1/auth/oauth`, {
social: "KAKAO",
social: 'KAKAO',
accessToken: accessToken,
})
.then((res) => res.data)
.then((data) => {
alert("로그인에 성공하였습니다!");
localStorage.setItem("accessToken", data.accessToken);
alert('로그인에 성공하였습니다!');
localStorage.setItem('accessToken', data.accessToken);
setIsKakaoLogin(true);
})
.catch((reason) => alert(reason.response.data.message));
};
const postAuthCode = async () => {
axios
.post(
"https://kauth.kakao.com/oauth/token",
'https://kauth.kakao.com/oauth/token',
{
grant_type: "authorization_code",
grant_type: 'authorization_code',
client_id: KAKAO_KEY,
redirect_uri: REDIRECT_URI,
code: code,
},
{
headers: {
"Content-Type":
"application/x-www-form-urlencoded;charset=utf-8",
'Content-Type':
'application/x-www-form-urlencoded;charset=utf-8',
},
},
)
Expand All @@ -100,13 +100,13 @@ const TopBar = ({ router }: { router: NextRouter }) => {
<>
<Header sx={{ backgroundColor: pallete.yello_sub_400 }}>
<Header.Item>
<Link href="/">
<Image alt="logo" src={logo} width={48} height={48} />
<Headline_00>{"Yello 어드민"}</Headline_00>
<Link href='/admin'>
<Image alt='logo' src={logo} width={48} height={48} />
<Headline_00>{'Yello 어드민'}</Headline_00>
</Link>
</Header.Item>
<Header.Item>
<Link href={GOOGLE_PLAY_URL}>{"Play Store"}</Link>
<Link href={GOOGLE_PLAY_URL}>{'Play Store'}</Link>
</Header.Item>
<Header.Item>
<Link href={APP_STORE_URL}>App Store</Link>
Expand All @@ -115,8 +115,8 @@ const TopBar = ({ router }: { router: NextRouter }) => {
{/* <Button variant="outline" onClick={() => login()}>
{isKakaoLogin ? "카카오 로그아웃" : "카카오 로그인"}
</Button> */}
<Button variant="outline" onClick={() => passwordLogin()}>
{isLogin ? "비밀번호 로그아웃" : "비밀번호 로그인"}
<Button variant='outline' onClick={() => passwordLogin()}>
{isLogin ? '비밀번호 로그아웃' : '비밀번호 로그인'}
</Button>
</Header.Item>
</Header>
Expand Down
Loading

0 comments on commit c6de1a0

Please sign in to comment.