Skip to content
Closed
Show file tree
Hide file tree
Changes from 3 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
36 changes: 36 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
name: CI

on:
push:
branches: [main, develop]
pull_request:
branches: [main, develop]

jobs:
ci:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22.x'
cache: 'npm'

- name: Install dependencies
run: npm ci

- name: Run linter
run: npm run lint

- name: Type check
run: npx tsc --noEmit

- name: Build
run: npm run build
env:
NODE_ENV: production

4 changes: 2 additions & 2 deletions src/app/login/LoginContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ const LoginContent = () => {
<input
type="email"
placeholder="이메일"
className="h-[41px] w-full rounded-lg border px-5 py-3 font-serif typo-regular-4 text-k-400 focus:outline-none"
className="w-full rounded-lg border border-k-100 px-5 py-3 font-serif typo-regular-4 text-k-400 focus:outline-none"
{...register("email", {
onChange: handleEmailChange,
})}
Expand All @@ -101,7 +101,7 @@ const LoginContent = () => {
<input
type="password"
placeholder="비밀번호"
className="h-[41px] w-full rounded-lg border px-5 py-3 font-serif typo-regular-4 text-k-400 focus:outline-none"
className="w-full rounded-lg border border-k-100 px-5 py-3 font-serif typo-regular-4 text-k-400 focus:outline-none"
{...register("password")}
onKeyDown={handleKeyDown}
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { z } from "zod";

import { validateLanguageScore } from "@/utils/scoreUtils";
import validateLanguageScore from "@/utils/scoreUtils";

import { LanguageTestEnum } from "@/types/score";

Expand Down
2 changes: 1 addition & 1 deletion src/components/button/BlockBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";

import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "@/utils/designUtils";
import cn from "@/utils/designUtils";

const blockBtnVariants = cva("h-13 w-full min-w-80 max-w-screen-sm rounded-lg flex items-center justify-center", {
variants: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/button/RoundBtn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as React from "react";

import { type VariantProps, cva } from "class-variance-authority";

import { cn } from "@/utils/designUtils";
import cn from "@/utils/designUtils";

const roundBtnVariants = cva("h-[2.375rem] w-[6.375rem] rounded-3xl px-4 py-2.5 ", {
variants: {
Expand Down
2 changes: 1 addition & 1 deletion src/components/ui/UniverSityCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Image from "next/image";
import Link from "next/link";

import { convertImageUrl } from "@/utils/fileUtils";
import { shortenLanguageTestName } from "@/utils/universityUtils";
import shortenLanguageTestName from "@/utils/universityUtils";

import CheveronRightFilled from "@/components/ui/icon/ChevronRightFilled";

Expand Down
4 changes: 3 additions & 1 deletion src/utils/designUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { type ClassValue, clsx } from "clsx";
import { twMerge } from "tailwind-merge";

export const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));
const cn = (...inputs: ClassValue[]) => twMerge(clsx(inputs));

export default cn;
18 changes: 9 additions & 9 deletions src/utils/jwtUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
interface JwtPayload {
sub: number;
role: string;
iat: number;
exp: number;
}

export const isTokenExpired = (token: string | null): boolean => {
if (!token) return true;
try {
const payload = JSON.parse(atob(token.split(".")[1]));
const payload = JSON.parse(atob(token.split(".")[1])) as JwtPayload;
const currentTime = Math.floor(Date.now() / 1000);
return payload.exp < currentTime;
} catch (error) {
Expand All @@ -10,20 +17,13 @@ export const isTokenExpired = (token: string | null): boolean => {
}
};

interface JwtPayload {
sub: number;
role: string;
iat: number;
exp: number;
}

export const tokenParse = (token: string | null): JwtPayload | null => {
if (typeof window === "undefined") return null;

if (!token) return null;

try {
const payload: JwtPayload = JSON.parse(atob(token.split(".")[1]));
const payload = JSON.parse(atob(token.split(".")[1])) as JwtPayload;
return payload;
} catch (error) {
console.error("토큰 파싱 오류:", error);
Expand Down
4 changes: 3 additions & 1 deletion src/utils/scoreUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { LanguageTestEnum } from "@/types/score";

export const validateLanguageScore = (testType: string, score: string) => {
const validateLanguageScore = (testType: string, score: string) => {
const numScore = Number(score);

if (testType === LanguageTestEnum.TOEIC) {
Expand Down Expand Up @@ -31,3 +31,5 @@ export const validateLanguageScore = (testType: string, score: string) => {
}
}
};

export default validateLanguageScore;
7 changes: 5 additions & 2 deletions src/utils/universityUtils.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
import { SHORT_LANGUAGE_TEST } from "@/constants/application";

export const shortenLanguageTestName = (name: string) => {
const shortenLanguageTestName = (name: string): string | undefined => {
if (Object.prototype.hasOwnProperty.call(SHORT_LANGUAGE_TEST, name)) {
return SHORT_LANGUAGE_TEST[name];
return SHORT_LANGUAGE_TEST[name] as string;
}
return undefined;
};

export default shortenLanguageTestName;
3 changes: 2 additions & 1 deletion src/utils/useInfinityScroll.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ const useInfinityScroll = ({
if (!node) return;

observerRef.current = new IntersectionObserver(
([entry]) => {
(entries) => {
const [entry] = entries;
if (entry.isIntersecting) {
fetchNextPage();
}
Expand Down
Loading