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

[TSK-44]デモで作成したファイル群をFSDアーキテクチャに沿うようにリファクタリングする #10

Merged
merged 4 commits into from
May 19, 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
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/game/layout.tsx → app/game/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { GameModeLayout } from '@/shared/layout/game-mode-layout';
import { GameModeLayout } from '@/widget/layout';

export default function Layout({
children,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 3 additions & 3 deletions src/app/layout.tsx → app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Auth0Provider } from '@/shared/libs/auth0/provider';
import { JotaiProvider } from '@/shared/libs/jotai/provider';
import '@/application/globals.css';
import { Auth0Provider } from '@/shared/libs/auth0';
import { JotaiProvider } from '@/shared/libs/jotai';
import type { Metadata } from 'next';
import './globals.css';

export const metadata: Metadata = {
title: 'Create Next App',
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@
},
"overrides": [
{
"include": ["src/shared/libs/gql-codegen/generated/"],
"include": ["src/shared/libs/gql-codegen/api/generated/"],
"linter": {
"rules": {
"suspicious": {
Expand All @@ -84,7 +84,7 @@
}
},
{
"include": ["src/shared/libs/pathpida/$path.ts"],
"include": ["src/shared/libs/pathpida/lib/$path.ts"],
"linter": {
"rules": {
"style": {
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
"scripts": {
"dev": "run-p dev:*",
"dev:next": "next dev",
"dev:path": "pathpida --ignorePath .gitignore --output ./src/shared/libs/pathpida --watch",
"build": "pathpida --ignorePath .gitignore --output ./src/shared/libs/pathpida && next build",
"dev:path": "pathpida --ignorePath .gitignore --output ./src/shared/libs/pathpida/lib --watch",
"build": "pathpida --ignorePath .gitignore --output ./src/shared/libs/pathpida/lib && next build",
"start": "next start",
"test": "vitest run",
"test:watch": "vitest watch",
Expand All @@ -18,7 +18,7 @@
"typecheck": "tsc --noEmit",
"lefthook:sync": "lefthook install",
"add:component": "bunx shadcn-ui@latest add",
"gql:codegen": "graphql-codegen --config ./src/shared/libs/gql-codegen/config.ts && bun format:fix && bun lint:fix"
"gql:codegen": "graphql-codegen --config ./src/shared/libs/gql-codegen/api/config.ts && bun format:fix && bun lint:fix"
},
"dependencies": {
"@auth0/nextjs-auth0": "^3.5.0",
Expand Down
Binary file removed src/app/favicon.ico
Binary file not shown.
Empty file added src/application/.gitkeep
Empty file.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/entitie/dartsboard/stores/atoms.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Darts_Positions } from '@/shared/libs/gql-codegen/generated/graphql';
import type { Darts_Positions } from '@/shared/libs/gql-codegen/api/generated/graphql';
import { atom } from 'jotai';

export type ConnectStatus = 'disconnected' | 'connecting' | 'connected';
Expand Down
2 changes: 2 additions & 0 deletions src/page/game-configure/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui';
export { default } from './ui';
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as TabsPrimitive from '@radix-ui/react-tabs';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import { Typography } from '@/shared/ui/typography';

const DifficultySelectorTabs = TabsPrimitive.Root;
Expand Down
2 changes: 2 additions & 0 deletions src/page/game-configure/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
2 changes: 2 additions & 0 deletions src/page/game-configure/ui/screen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
'use client';

import { pagesPath } from '@/shared/libs/pathpida/$path';
import { pagesPath } from '@/shared/libs/pathpida';
import { Button } from '@/shared/ui/button';
import { Typography } from '@/shared/ui/typography';
import { GameHeader } from '@/widget/game-header';
import { GameHeader } from '@/widget/ui/game-header';
import { HomeIcon, MenuIcon } from 'lucide-react';
import Link from 'next/link';
import { useSearchParams } from 'next/navigation';
Expand All @@ -12,7 +12,7 @@ import {
DifficultySelectorTabs,
DifficultySelectorTabsList,
DifficultySelectorTabsTrigger,
} from './ui/difficulty-selector-tabs';
} from '../difficulty-selector-tabs';

export type Query = {
game_name: 'target-bull' | 'cr-number';
Expand Down
2 changes: 2 additions & 0 deletions src/page/game-home/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui';
export { default } from './ui';
2 changes: 2 additions & 0 deletions src/page/game-home/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
2 changes: 2 additions & 0 deletions src/page/game-home/ui/screen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';

import { useConnectDartsliveHome } from '@/entitie/dartsboard/hooks/use-connect-dartslive-home';
import { pagesPath } from '@/shared/libs/pathpida/$path';
import { pagesPath } from '@/shared/libs/pathpida';
import { Button } from '@/shared/ui/button';
import { Typography } from '@/shared/ui/typography';
import { GameHeader } from '@/widget/game-header';
import { GameHeader } from '@/widget/ui/game-header';
import {
BluetoothIcon,
BluetoothOffIcon,
Expand Down
2 changes: 2 additions & 0 deletions src/page/game-play/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui';
export { default } from './ui';
2 changes: 2 additions & 0 deletions src/page/game-play/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
2 changes: 2 additions & 0 deletions src/page/game-play/ui/screen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { useConnectDartsliveHome } from '@/entitie/dartsboard/hooks/use-connect-dartslive-home';
import { pagesPath } from '@/shared/libs/pathpida/$path';
import { pagesPath } from '@/shared/libs/pathpida';
import { Button } from '@/shared/ui/button';
import { ScrollArea } from '@/shared/ui/scroll-area';
import { Separator } from '@/shared/ui/separator';
Expand Down
2 changes: 2 additions & 0 deletions src/page/game-result/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui';
export { default } from './ui';
2 changes: 2 additions & 0 deletions src/page/game-result/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
2 changes: 2 additions & 0 deletions src/page/game-result/ui/screen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use client';

import { useConnectDartsliveHome } from '@/entitie/dartsboard/hooks/use-connect-dartslive-home';
import { pagesPath } from '@/shared/libs/pathpida/$path';
import { pagesPath } from '@/shared/libs/pathpida';
import { Button } from '@/shared/ui/button';
import { Typography } from '@/shared/ui/typography';
import { GameHeader } from '@/widget/game-header';
import { GameHeader } from '@/widget/ui/game-header';
import { HomeIcon, MenuIcon, RotateCcwIcon } from 'lucide-react';
import Link from 'next/link';
import { useMemo } from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/page/home/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './ui';
export { default } from './ui';
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/date-range-picker.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import { Button } from '@/shared/ui/button';
import { Calendar } from '@/shared/ui/calendar';
import { Popover, PopoverContent, PopoverTrigger } from '@/shared/ui/popover';
Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/game-play-statistics-chart.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApexchartsBase } from '@/shared/libs/apexcharts/apexcharts-base';
import { ApexchartsBase } from '@/shared/libs/apexcharts';
import { format } from '@formkit/tempo';
import type { FC } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/main-nav.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import Link from 'next/link';

export function MainNav({
Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/recent-30-days-mpr.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApexchartsBase } from '@/shared/libs/apexcharts/apexcharts-base';
import { ApexchartsBase } from '@/shared/libs/apexcharts';
import { format } from '@formkit/tempo';
import type { FC } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/recent-30-days-ppr.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApexchartsBase } from '@/shared/libs/apexcharts/apexcharts-base';
import { ApexchartsBase } from '@/shared/libs/apexcharts';
import { format } from '@formkit/tempo';
import type { FC } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/recent-30-days-rating.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ApexchartsBase } from '@/shared/libs/apexcharts/apexcharts-base';
import { ApexchartsBase } from '@/shared/libs/apexcharts';
import { format } from '@formkit/tempo';
import type { FC } from 'react';

Expand Down
2 changes: 1 addition & 1 deletion src/page/home/ui/demo/team-switcher.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import { Avatar, AvatarFallback, AvatarImage } from '@/shared/ui/avatar';
import { Button } from '@/shared/ui/button';
import {
Expand Down
2 changes: 2 additions & 0 deletions src/page/home/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
4 changes: 2 additions & 2 deletions src/page/home/ui/rating-charts/rating-charts.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ApexchartsBase } from '@/shared/libs/apexcharts/apexcharts-base';
import { cn } from '@/shared/libs/shadcn/utils';
import { ApexchartsBase } from '@/shared/libs/apexcharts';
import { cn } from '@/shared/libs/shadcn';
import { Typography } from '@/shared/ui/typography';
import { ChevronDownIcon, ChevronUpIcon } from 'lucide-react';
import type { FC } from 'react';
Expand Down
2 changes: 2 additions & 0 deletions src/page/home/ui/screen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
export * from './screen';
export { default } from './screen';
10 changes: 5 additions & 5 deletions src/page/home/index.tsx → src/page/home/ui/screen/screen.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import { pagesPath } from '@/shared/libs/pathpida/$path';
import { pagesPath } from '@/shared/libs/pathpida';
import { Button } from '@/shared/ui/button';
import { Card, CardContent, CardHeader, CardTitle } from '@/shared/ui/card';
import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/shared/ui/tabs';
import Link from 'next/link';
import { GamePlayStatisticsChart } from './ui/demo/game-play-statistics-chart';
import { Recent30DaysMPR } from './ui/demo/recent-30-days-mpr';
import { Recent30DaysPPR } from './ui/demo/recent-30-days-ppr';
import { Recent30DaysRating } from './ui/demo/recent-30-days-rating';
import { GamePlayStatisticsChart } from '../demo/game-play-statistics-chart';
import { Recent30DaysMPR } from '../demo/recent-30-days-mpr';
import { Recent30DaysPPR } from '../demo/recent-30-days-ppr';
import { Recent30DaysRating } from '../demo/recent-30-days-rating';

export default function Home() {
return (
Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/apexcharts/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ui';
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use client';

import dynamic from 'next/dynamic';

import type { FC } from 'react';
import type { Props as ApexChartsProps } from 'react-apexcharts';

const ApexCharts = dynamic(() => import('react-apexcharts'), { ssr: false });

export const ApexchartsBase = (props: ApexChartsProps) => {
export const ApexchartsBase: FC<ApexChartsProps> = props => {
return (
<>
<ApexCharts {...props} />
Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/apexcharts/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { ApexchartsBase } from './apexcharts-base';
1 change: 1 addition & 0 deletions src/shared/libs/auth0/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ui';
1 change: 1 addition & 0 deletions src/shared/libs/auth0/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { Auth0Provider } from './provider';
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const config: CodegenConfig = {
],
documents: ['src/**/*.tsx', 'src/**/*.ts', 'src/**/*.graphql'],
generates: {
'src/shared/libs/gql-codegen/generated/': {
'src/shared/libs/gql-codegen/api/generated/': {
preset: 'client',
config: {
gqlTagName: 'graphql',
Expand All @@ -32,7 +32,7 @@ const config: CodegenConfig = {
useTypeImports: true,
},
},
'src/shared/libs/gql-codegen/generated/sdk.ts': {
'src/shared/libs/gql-codegen/api/generated/sdk.ts': {
plugins: [
{
add: {
Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/gql-codegen/api/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { graphqlSdk } from './graphql-sdk';
1 change: 1 addition & 0 deletions src/shared/libs/gql-codegen/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './api';
1 change: 1 addition & 0 deletions src/shared/libs/jotai/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './ui';
1 change: 1 addition & 0 deletions src/shared/libs/jotai/ui/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { JotaiProvider } from './provider';
1 change: 1 addition & 0 deletions src/shared/libs/pathpida/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Query as Query_17iukn9 } from '../../../app/game/configure/page';
import type { Query as Query_1iv4wk1 } from '../../../app/game/play/page';
import type { Query as Query_18ddyjz } from '../../../../../app/game/configure/page';
import type { Query as Query_ibwa07 } from '../../../../../app/game/play/page';

const buildSuffix = (url?: {
query?: Record<string, string>;
Expand All @@ -15,15 +15,15 @@ const buildSuffix = (url?: {
export const pagesPath = {
game: {
configure: {
$url: (url: { query: Query_17iukn9; hash?: string }) => ({
$url: (url: { query: Query_18ddyjz; hash?: string }) => ({
pathname: '/game/configure' as const,
query: url.query,
hash: url.hash,
path: `/game/configure${buildSuffix(url)}`,
}),
},
play: {
$url: (url: { query: Query_1iv4wk1; hash?: string }) => ({
$url: (url: { query: Query_ibwa07; hash?: string }) => ({
pathname: '/game/play' as const,
query: url.query,
hash: url.hash,
Expand Down
1 change: 1 addition & 0 deletions src/shared/libs/pathpida/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { pagesPath } from './$path';
1 change: 1 addition & 0 deletions src/shared/libs/shadcn/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export * from './lib';
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, expect, test } from 'vitest';
import { cn } from './utils';
import { cn } from './cn';

describe('cn', () => {
test('配列を受け取り合成することができる', () => {
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/shared/libs/shadcn/lib/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { cn } from './cn';
2 changes: 1 addition & 1 deletion src/shared/ui/avatar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import * as AvatarPrimitive from '@radix-ui/react-avatar';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';

const Avatar = React.forwardRef<
React.ElementRef<typeof AvatarPrimitive.Root>,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Slot } from '@radix-ui/react-slot';
import { type VariantProps, cva } from 'class-variance-authority';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';

const buttonVariants = cva(
'inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50',
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/calendar.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use client';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import { buttonVariants } from '@/shared/ui/button';
import { ChevronLeft, ChevronRight } from 'lucide-react';
import type * as React from 'react';
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/card.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';

const Card = React.forwardRef<
HTMLDivElement,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Command as CommandPrimitive } from 'cmdk';
import { Search } from 'lucide-react';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';
import { Dialog, DialogContent } from '@/shared/ui/dialog';

const Command = React.forwardRef<
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/dialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as DialogPrimitive from '@radix-ui/react-dialog';
import { X } from 'lucide-react';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';

const Dialog = DialogPrimitive.Root;

Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/dropdown-menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
import { Check, ChevronRight, Circle } from 'lucide-react';
import * as React from 'react';

import { cn } from '@/shared/libs/shadcn/utils';
import { cn } from '@/shared/libs/shadcn';

const DropdownMenu = DropdownMenuPrimitive.Root;

Expand Down
Loading