Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#228] Cleanup directories and update imports #229

Merged
merged 1 commit into from
Mar 9, 2024
Merged
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: 1 addition & 1 deletion ui/src/app/(board)/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Header } from '@/components/layout/header';
import { Header } from '@/components/common/server/header';

export default function Layout({ children }: { children: React.ReactNode }) {
return (
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/(board)/review/page.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Suspense } from 'react';

import { ReviewBoardHeader } from '@/components/review-board-header';
import { ReviewCardsList } from '@/components/review-cards-list';
import { ReviewBoardHeader } from '@/components/review/client/review-board-header';
import { ReviewCardsList } from '@/components/review/server/review-cards-list';
import { ReviewCardsListSkeleton } from '@/components/skeletons';

import type { ListReviewsQuery } from '@/lib/definitions/review';
Expand Down
4 changes: 2 additions & 2 deletions ui/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Metadata } from 'next';
import '@/styles/globals.css';
import { notoSansKr } from '@/fonts';
import { AuthProvider } from '@/context/auth-context';
import { notoSansKr } from '@/styles/fonts';
import { AuthProvider } from '@/context/auth/auth-context';

export const metadata: Metadata = {
title: 'Home',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import Text from '@/components/atomic/text';
import { useAuth } from '@/context/auth-context';
import Text from '@/components/common/server/text';
import { useAuth } from '@/context/auth/auth-context';

export default function SignButton() {
const { user, signOut, signIn } = useAuth();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Meta, StoryObj } from '@storybook/react';
import { within, userEvent, expect } from '@storybook/test';

import UserChip from '@/components/user-chip';
import UserChip from '@/components/auth/client/user-chip';
import { action } from '@storybook/addon-actions';

const meta = {
title: 'Common/UserChip',
title: 'Auth/UserChip',
component: UserChip,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import ChipButton from '@/components/atomic/chip-button';
import Text from '@/components/atomic/text';
import { useDropdown } from '@/hooks/use-dropdown';
import { useSearchMore } from '@/hooks/use-search-more';
import ChipButton from '@/components/common/client/chip-button';
import Text from '@/components/common/server/text';
import { useDropdown } from '@/hooks/common/use-dropdown';
import { useSearchMore } from '@/hooks/common/use-search-more';

export default function UserChip({ nickname, tag }: { nickname: string; tag: string }) {
const { targetRef, toggleDropdown, isDropdownOpen } = useDropdown<HTMLDivElement>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { type Locale, formatDateToLocal } from '@/lib/utils/format-date-to-local';
import Text, { type TextProps } from '@/components/atomic/text';
import { type Locale, formatDateToLocal } from '@/lib/utils/common/format-date-to-local';
import Text, { type TextProps } from '@/components/common/server/text';

interface Props extends Omit<TextProps, 'children'> {
dateStr: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import Link from 'next/link';
import { usePathname } from 'next/navigation';
import Text from '@/components/atomic/text';
import Text from '@/components/common/server/text';

interface Link {
name: string;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Meta, StoryObj } from '@storybook/react';

import Pagination from '@/components/layout/pagination';
import Pagination from '@/components/common/client/pagination';

const meta = {
title: 'Layout/Pagination',
title: 'Common/Pagination',
component: Pagination,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { usePagination } from '@/hooks/use-pagination';
import { usePagination } from '@/hooks/common/use-pagination';
import {
ChevronLeftIcon,
ChevronRightIcon,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Meta, StoryObj } from '@storybook/react';

import SearchForm from '@/components/search-form';
import SearchForm from '@/components/common/client/search-form';
import { action } from '@storybook/addon-actions';

const meta = {
title: 'Board/SearchForm',
title: 'Common/SearchForm',
component: SearchForm,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ import {

import { ChangeEventHandler } from 'react';

import Text from '@/components/atomic/text';
import { useSearchFormState } from '@/hooks/use-search-form-state';
import { useDropdown } from '@/hooks/use-dropdown';
import { FiltersProvider, useFilters } from '@/context/filters-context';
import Text from '@/components/common/server/text';
import { useSearchFormState } from '@/hooks/common/use-search-form-state';
import { useDropdown } from '@/hooks/common/use-dropdown';
import { FiltersProvider, useFilters } from '@/context/common/filters-context';
import { useSearchParams } from 'next/navigation';
import ChipButton from '@/components/atomic/chip-button';
import ChipButton from '@/components/common/client/chip-button';

function FilterInput({ filter }: { filter: string }) {
const {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useEffect, useState } from 'react';
import { NavLinks } from '@/components/layout/nav-links';
import { NavLinks } from '@/components/common/client/nav-links';
import { usePathname } from 'next/navigation';
import { Bars3Icon, XMarkIcon } from '@heroicons/react/24/outline';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { NavLinks } from '@/components/layout/nav-links';
import Logo from '@/components/logo';
import SideBar from '@/components/layout/sidebar';
import { NavLinks } from '@/components/common/client/nav-links';
import Logo from '@/components/common/server/logo';
import SideBar from '@/components/common/client/sidebar';
import Link from 'next/link';
import SignButton from '@/components/layout/sign-button';
import SignButton from '@/components/auth/client/sign-button';

export function Header() {
return (
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Meta, StoryObj } from '@storybook/react';
import Time from '@/components/time';
import Time from '@/components/common/server/time';

const meta = {
title: 'Common/Time',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import dynamic from 'next/dynamic';

import Text from '@/components/atomic/text';
import Text from '@/components/common/server/text';

const Time = dynamic(() => import('@/components/time/client-time'), {
const Time = dynamic(() => import('@/components/common/client/client-time'), {
ssr: false,
loading: () => (
<div className="inline-block">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use client';

import Text from '@/components/atomic/text';
import { BoardHeader } from '@/components/board-header';
import SearchForm from '@/components/search-form';
import Text from '@/components/common/server/text';
import { BoardHeader } from '@/components/common/server/board-header';
import SearchForm from '@/components/common/client/search-form';
import Link from 'next/link';
import { useState } from 'react';

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Meta, StoryObj } from '@storybook/react';

import { ReviewCard } from '@/components/review-card';
import { ReviewCard } from '@/components/review/client/review-card';
import { action } from '@storybook/addon-actions';

const meta = {
title: 'Board/ReviewCard',
title: 'Review/ReviewCard',
component: ReviewCard,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import Link from 'next/link';

import Text from '@/components/atomic/text';
import Time from '@/components/time';
import UserChip from '@/components/user-chip';
import Text from '@/components/common/server/text';
import Time from '@/components/common/server/time';
import UserChip from '@/components/auth/client/user-chip';

import type { Review } from '@/lib/definitions/review';
import { parseReviewContent } from '@/lib/utils/parse-review-content';
import { parseReviewContent } from '@/lib/utils/review/parse-review-content';

export function ReviewCard({ review }: { review: Review }) {
const { content, createdAt, movieName, nickname, tag, updatedAt, title } = review;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Pagination from '@/components/layout/pagination';
import { ReviewCard } from '@/components/review-card';
import Pagination from '@/components/common/client/pagination';
import { ReviewCard } from '@/components/review/client/review-card';

import { listReviews } from '@/lib/apis/review/server';
import type { ListReviewsQuery } from '@/lib/definitions/review';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { fetchSignOut, getUserSelf, linkToSignIn } from '@/lib/apis/auth/client';
import { User } from '@/lib/definitions/user';
import { User } from '@/lib/definitions/auth';
import { ReactNode, createContext, useContext, useEffect, useState } from 'react';

interface ContextShape {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import type { Meta, StoryObj } from '@storybook/react';
import { within, userEvent, expect } from '@storybook/test';

import Editor from '@/components/editor';
import Editor from '@/editor';

const meta = {
title: 'Review/Editor',
title: 'Editor',
component: Editor,
parameters: {
layout: 'centered',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { LexicalComposer, type InitialConfigType } from '@lexical/react/LexicalComposer';
import { Plugins } from '@/components/editor/plugins';
import nodes from '@/components/editor/nodes';
import theme from '@/components/editor/theme';
import { Plugins } from '@/editor/plugins';
import nodes from '@/editor/nodes';
import theme from '@/editor/theme';
import '@/styles/editor.css';

// This has to be rendered on client side only (no ssr!)
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { RichTextPlugin } from '@lexical/react/LexicalRichTextPlugin';
import LexicalErrorBoundary from '@lexical/react/LexicalErrorBoundary';
import { ContentEditable } from '@lexical/react/LexicalContentEditable';
import { MarkdownShortcutPlugin } from '@/components/editor/plugins/markdown-shorcut';
import { MarkdownShortcutPlugin } from '@/editor/plugins/markdown-shorcut';

function Placeholder() {
return <div className="placeholder">Begin writing your review...</div>;
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useOutsideClick } from '@/hooks/use-outside-click';
import { useOutsideClick } from '@/hooks/common/use-outside-click';
import { useRef, useState } from 'react';

export function useDropdown<T extends HTMLElement>() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useRef } from 'react';
import { useOutsideClick } from '@/hooks/use-outside-click';
import { useOutsideClick } from '@/hooks/common/use-outside-click';
import { cleanup, click, clickRight, pointerDown, pointerUp, render } from '@/lib/test-utils';

function OutsideClicker({ onOutsideClick }: { onOutsideClick: () => void }) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { redirect, usePathname, useSearchParams } from 'next/navigation';
import { generatePagination } from '@/lib/utils/generate-pagination';
import { generatePagination } from '@/lib/utils/common/generate-pagination';

export function usePagination(totalPages: number) {
const pathname = usePathname();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { usePathname, useRouter } from 'next/navigation';
import { useEffect } from 'react';
import { useFormState } from 'react-dom';

import { isString } from '@/lib/utils/is-string';
import { isString } from '@/lib/utils/common/is-string';

interface SearchFormState {
error?: string | null;
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/src/lib/apis/auth/client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { User } from '@/lib/definitions/user';
import { User } from '@/lib/definitions/auth';

export async function getUserSelf() {
const response = await fetch('/api/v1/users/self');
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/src/lib/definitions/comment.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Pagination } from '@/lib/definitions/pagination';
import type { Pagination } from '@/lib/definitions/common';

interface Comment {
id: number; //123,
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion ui/src/lib/definitions/review.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Pagination } from '@/lib/definitions/pagination';
import type { Pagination } from '@/lib/definitions/common';

export interface Review {
id: number; // 213,
Expand Down
2 changes: 1 addition & 1 deletion ui/src/lib/dummy/user.ts → ui/src/lib/dummy/auth.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// TODO: Remove dummy after connected with backend apis

import type { User } from '@/lib/definitions/user';
import type { User } from '@/lib/definitions/auth';

const dummyUser: User = {
id: '7289ae9c-42b1-49ca-8f5b-a1831583e903',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { formatDateToLocal } from '@/lib/utils/format-date-to-local';
import { formatDateToLocal } from '@/lib/utils/common/format-date-to-local';

function getRelativeDateStr(interval: number) {
const currentDateTime = new Date().getTime();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { generatePagination } from '@/lib/utils/generate-pagination';
import { generatePagination } from '@/lib/utils/common/generate-pagination';

describe('generatePagination', () => {
test.each([
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {

import { createHeadlessEditor } from '@lexical/headless';

import { getReviewContent } from '@/lib/utils/get-review-content';
import { getReviewContent } from '@/lib/utils/review/get-review-content';

describe('getReviewContent', () => {
let editor: LexicalEditor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {

import { createHeadlessEditor } from '@lexical/headless';

import { validateReviewFields } from '@/lib/utils/validate-review-fields';
import { validateReviewFields } from '@/lib/utils/review/validate-review-fields';

describe('validateReviewFields', () => {
let editor: LexicalEditor;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { EditorState, SerializedEditorState } from 'lexical';
import { $isRootTextContentEmptyCurry } from '@lexical/text';

import { getReviewContent } from '@/lib/utils/get-review-content';
import { getReviewContent } from '@/lib/utils/review/get-review-content';
import type { CreateReviewRequest } from '@/lib/definitions/review';

interface RawReviewField {
Expand Down
File renamed without changes.
Loading