Skip to content

Commit

Permalink
Merge pull request #289 from GiganticMinecraft/refactor/dir
Browse files Browse the repository at this point in the history
ディレクトリ構成を変更
  • Loading branch information
Lucky authored Oct 27, 2023
2 parents 0a6204f + da84a66 commit b71412c
Show file tree
Hide file tree
Showing 24 changed files with 39 additions and 39 deletions.
8 changes: 4 additions & 4 deletions src/app/admin/page.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { getAllAnswers } from '@/api/form';
import { getCachedToken } from '@/api/mcToken';
import DataTable from '@/components/dashboard';
import DashboardMenu from '@/components/dashboardMenu';
import DataTable from '@/components/Dashboard';
import DashboardMenu from '@/components/DashboardMenu';
import NavBar from '@/components/NavBar';
import { getAllAnswers } from '@/features/form/api/form';
import { getCachedToken } from '@/features/user/api/mcToken';
import styles from '../page.module.css';

const Home = async () => {
Expand Down
6 changes: 3 additions & 3 deletions src/app/forms/[formId]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getForm } from '@/api/form';
import { getCachedToken } from '@/api/mcToken';
import AnswerForm from '@/components/AnswerForm';
import { getForm } from '@/features/form/api/form';
import AnswerForm from '@/features/form/components/AnswerForm';
import { getCachedToken } from '@/features/user/api/mcToken';

const Home = async ({ params }: { params: { formId: number } }) => {
const token = getCachedToken() ?? '';
Expand Down
6 changes: 3 additions & 3 deletions src/app/forms/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { getForms } from '@/api/form';
import { getCachedToken } from '@/api/mcToken';
import FormList from '@/components/FormList';
import { getForms } from '@/features/form/api/form';
import FormList from '@/features/form/components/FormList';
import { getCachedToken } from '@/features/user/api/mcToken';

const Home = async () => {
const token = getCachedToken() ?? '';
Expand Down
8 changes: 4 additions & 4 deletions src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import './globals.css';
import { Inter } from 'next/font/google';
import { AuthenticatedTemplate } from '@/components/AuthenticatedTemplate';
import { MsalProvider } from '@/components/MsalProvider';
import NavBar from '@/components/NavBar';
import { NeedToSignin } from '@/components/NeedToSignin';
import { UnauthenticatedTemplate } from '@/components/UnauthenticatedTemplate';
import { AuthenticatedTemplate } from '@/features/user/components/AuthenticatedTemplate';
import { MsalProvider } from '@/features/user/components/MsalProvider';
import { NeedToSignin } from '@/features/user/components/NeedToSignin';
import { UnauthenticatedTemplate } from '@/features/user/components/UnauthenticatedTemplate';
import styles from './page.module.css';
import type { Metadata } from 'next';
import type { ReactNode } from 'react';
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';
import { DataGrid, type GridColDef } from '@mui/x-data-grid';
import * as React from 'react';
import type { BatchAnswer } from '@/schemas/formSchema';
import type { BatchAnswer } from '@/features/form/types/formSchema';

const columns: GridColDef[] = [
{ field: 'category', headerName: '種別', width: 200 },
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/components/Menu.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client';

import { Box, Button, styled, Stack, Typography } from '@mui/material';
import { Link } from './link';
import { Link } from './Link';

const Item = styled(Button)(({ theme }) => ({
backgroundColor:
Expand Down
10 changes: 5 additions & 5 deletions src/components/NavBar.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import MenuIcon from '@mui/icons-material/Menu';
import { Box, AppBar, Toolbar, IconButton, Typography } from '@mui/material';
import { AuthenticatedTemplate } from './AuthenticatedTemplate';
import { Link } from './link';
import { SigninButton } from './SigninButton';
import { SignoutButton } from './SignoutButton';
import { UnauthenticatedTemplate } from './UnauthenticatedTemplate';
import { Link } from './Link';
import { AuthenticatedTemplate } from '../features/user/components/AuthenticatedTemplate';
import { SigninButton } from '../features/user/components/SigninButton';
import { SignoutButton } from '../features/user/components/SignoutButton';
import { UnauthenticatedTemplate } from '../features/user/components/UnauthenticatedTemplate';

const NavBar = () => {
return (
Expand Down
4 changes: 2 additions & 2 deletions src/api/form.ts → src/features/form/api/form.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
batchAnswersSchema,
formSchema,
formsSchema,
} from '@/schemas/formSchema';
import type { BatchAnswer, Form } from '@/schemas/formSchema';
} from '../types/formSchema';
import type { BatchAnswer, Form } from '../types/formSchema';

export const getForms = async (token: string) => {
const response = await fetch('http://localhost:9000/forms', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import {
Divider,
Button,
Typography,
Link,
} from '@mui/material';
import { useState } from 'react';
import { useForm } from 'react-hook-form';
import { postAnswers } from '@/api/form';
import { getCachedToken } from '@/api/mcToken';
import { Link } from './link';
import type { Form, FormQuestion } from '@/schemas/formSchema';
import { getCachedToken } from '@/features/user/api/mcToken';
import { postAnswers } from '../api/form';
import type { Form, FormQuestion } from '../types/formSchema';

interface Props {
form: Form;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import {
import dayjs, { extend } from 'dayjs';
import timezone from 'dayjs/plugin/timezone';
import utc from 'dayjs/plugin/utc';
import { Link } from './link';
import type { Form } from '@/schemas/formSchema';
import { Link } from '@/components/Link';
import type { Form } from '../types/formSchema';

extend(timezone);
extend(utc);
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions src/api/login.ts → src/features/user/api/login.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use server';

import {
xboxLiveServiceTokenResponseSchema,
minecraftAccessTokenResponseSchema,
minecraftProfileResponseSchema,
xboxLiveServiceTokenResponseSchema,
} from '@/schemas/loginSchema';
} from '../types/loginSchema';

export const acquireXboxLiveToken = async (token: string) => {
const URL = 'https://user.auth.xboxlive.com/user/authenticate';
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCachedToken } from '@/api/mcToken';
import { getCachedToken } from '../api/mcToken';
import type { ReactNode } from 'react';

type Props = { children: ReactNode };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import { PublicClientApplication } from '@azure/msal-browser';
import { MsalProvider as MsalLibProvider } from '@azure/msal-react';
import { msalConfig } from '@/authConfig';
import { msalConfig } from '../const/authConfig';
import type { ReactNode } from 'react';

const msalInstance = new PublicClientApplication(msalConfig);
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ import {
acquireMinecraftAccessToken,
acquireXboxLiveToken,
acquireXboxServiceSecurityToken,
} from '@/api/login';
import { saveTokenToCache } from '@/api/mcToken';
import { loginRequest } from '@/authConfig';
} from '../api/login';
import { saveTokenToCache } from '../api/mcToken';
import { loginRequest } from '../const/authConfig';

export const SigninButton = () => {
const { instance } = useMsal();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import { useMsal } from '@azure/msal-react';
import { Button } from '@mui/material';
import { useRouter } from 'next/navigation';
import { clearCachedToken } from '@/api/mcToken';
import { clearCachedToken } from '../api/mcToken';

export const SignoutButton = () => {
const { instance } = useMsal();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getCachedToken } from '@/api/mcToken';
import { getCachedToken } from '../api/mcToken';
import type { ReactNode } from 'react';

type Props = { children: ReactNode };
Expand Down
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { NextResponse } from 'next/server';
import { getCachedToken } from './api/mcToken';
import { getCachedToken } from '@/features/user/api/mcToken';
import type { NextRequest } from 'next/server';

export const middleware = (request: NextRequest) => {
Expand Down

0 comments on commit b71412c

Please sign in to comment.