Skip to content

Commit

Permalink
🚚 refactor: move dir from page to app and remove .page suffix (lobehu…
Browse files Browse the repository at this point in the history
…b#236)

* 🚚 chore: move page file to appp dir

* ♻️ refactor: refactor *.page.tsx to *.tsx

* 🎨 chore: improve import
arvinxx authored Sep 26, 2023

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent b70e3b1 commit 2907303
Showing 137 changed files with 36 additions and 37 deletions.
2 changes: 1 addition & 1 deletion next.config.mjs
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ const withPWA = nextPWA({
/** @type {import('next').NextConfig} */
const nextConfig = {
reactStrictMode: true,
pageExtensions: ['page.tsx', 'api.ts'],
pageExtensions: ['tsx', 'api.ts'],
transpilePackages: ['@lobehub/ui'],
webpack(config) {
config.experiments = {
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -119,7 +119,6 @@
"@types/react": "^18",
"@types/react-dom": "^18",
"@types/systemjs": "^6.13.2",
"@types/testing-library__jest-dom": "^6",
"@types/uuid": "^9",
"@umijs/lint": "^4",
"@vitest/coverage-v8": "latest",
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/chat/index.tsx → src/app/chat/index.tsx
Original file line number Diff line number Diff line change
@@ -13,8 +13,8 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';
import Conversation from './features/Conversation';
import Header from './features/Header';
import SideBar from './features/Sidebar';
import DesktopLayout from './layout';
import MobileLayout from './layout.mobile';
import DesktopLayout from './layout.pc';

const Chat = memo(() => {
const { mobile } = useResponsive();
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -5,12 +5,12 @@ import { memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import AppMobileLayout from '@/layout/AppMobileLayout';
import Header from '@/pages/chat/features/Header';
import { useSessionStore } from '@/store/session';
import { agentSelectors } from '@/store/session/selectors';
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';

import Conversation from '../features/Conversation';
import Header from '../features/Header';
import SideBar from '../features/Sidebar';

const Chat = memo(() => {
7 changes: 0 additions & 7 deletions src/app/chat/mobile/page.page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Page from '@/pages/chat';
import Page from './index';

const Index = () => {
return <Page />;
2 changes: 1 addition & 1 deletion src/app/page.page.tsx → src/app/chat/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Page from '@/pages/home';
import Page from './index';

const Index = () => {
return <Page />;
Original file line number Diff line number Diff line change
@@ -11,8 +11,8 @@ import { useSessionStore } from '@/store/session';
import { agentSelectors } from '@/store/session/selectors';
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';

import DesktopLayout from './layout';
import MobileLayout from './layout.mobile';
import DesktopLayout from './layout.pc';

const EditPage = memo(() => {
const { mobile } = useResponsive();
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -4,7 +4,7 @@ import { Flexbox } from 'react-layout-kit';
import SafeSpacing from '@/components/SafeSpacing';
import { HEADER_HEIGHT } from '@/const/layoutTokens';

import ChatLayout from '../layout';
import ChatLayout from '../layout.pc';
import Header from './features/Header';

const DesktopLayout = memo<PropsWithChildren>(({ children }) => {
7 changes: 0 additions & 7 deletions src/app/chat/settings/page.page.tsx

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Page from '@/pages/market';
import Page from './index';

const Index = () => {
return <Page />;
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/home/index.tsx → src/app/home/index.tsx
Original file line number Diff line number Diff line change
@@ -2,7 +2,6 @@

import { memo } from 'react';

import Loading from '@/pages/home/Loading';
import {
useEffectAfterSessionHydrated,
useSessionHydrated,
@@ -11,6 +10,7 @@ import {
import { sessionSelectors } from '@/store/session/selectors';

import Welcome from '../welcome';
import Loading from './Loading';

const Home = memo(() => {
const hydrated = useSessionHydrated();
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -3,13 +3,13 @@ import { memo, useState } from 'react';
import { useTranslation } from 'react-i18next';
import { Flexbox } from 'react-layout-kit';

import TokenTag from '@/pages/market/features/SideBar/AgentInfo/TokenTag';
import { useMarketStore } from '@/store/market';

import AgentCardBanner from '../../AgentCard/AgentCardBanner';
import Comment from './Comment';
import Header from './Header';
import Loading from './Loading';
import TokenTag from './TokenTag';
import { useStyles } from './style';

enum InfoTabs {
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/market/index.tsx → src/app/market/index.tsx
Original file line number Diff line number Diff line change
@@ -10,8 +10,8 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';

import AgentCard from './features/AgentCard';
import AgentSearchBar from './features/AgentSearchBar';
import DesktopLayout from './layout';
import MobileLayout from './layout.mobile';
import DesktopLayout from './layout.pc';

const Market = memo(() => {
const { t } = useTranslation('common');
Original file line number Diff line number Diff line change
@@ -2,10 +2,10 @@ import { ReactNode, memo } from 'react';
import { Flexbox } from 'react-layout-kit';

import AppMobileLayout from '@/layout/AppMobileLayout';
import SideBar from '@/pages/market/features/SideBar';
import { useSwitchSideBarOnInit } from '@/store/global';

import Header from './features/Header';
import SideBar from './features/SideBar';

const MarketLayout = memo<{ children: ReactNode }>(({ children }) => {
useSwitchSideBarOnInit('market');
File renamed without changes.
2 changes: 1 addition & 1 deletion src/app/welcome/page.page.tsx → src/app/market/page.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Page from '@/pages/welcome';
import Page from './index';

const Index = () => {
return <Page />;
7 changes: 7 additions & 0 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Page from './home';

const Index = () => {
return <Page />;
};

export default Index;
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import { useSwitchSideBarOnInit } from '@/store/global';
import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';

import Settings from './features/Settings';
import DesktopLayout from './layout';
import MobileLayout from './layout.mobile';
import DesktopLayout from './layout.pc';

const Setting = memo(() => {
const { mobile } = useResponsive();
File renamed without changes.
File renamed without changes.
7 changes: 0 additions & 7 deletions src/app/settings/page.page.tsx

This file was deleted.

7 changes: 7 additions & 0 deletions src/app/settings/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Page from './index';

const Index = () => {
return <Page />;
};

export default Index;
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion src/pages/welcome/index.tsx → src/app/welcome/index.tsx
Original file line number Diff line number Diff line change
@@ -9,8 +9,8 @@ import { genSiteHeadTitle } from '@/utils/genSiteHeadTitle';

import Banner from './features/Banner';
import Footer from './features/Footer';
import Layout from './layout';
import Mobile from './layout.mobile';
import Layout from './layout.pc';

const Welcome = memo(() => {
const { mobile } = useResponsive();
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions src/app/welcome/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import Page from './index';

const Index = () => {
return <Page />;
};

export default Index;

0 comments on commit 2907303

Please sign in to comment.