Skip to content

Commit ec5ba6e

Browse files
committed
chore(platform): move types to utils types
1 parent c826fcf commit ec5ba6e

File tree

9 files changed

+30
-30
lines changed

9 files changed

+30
-30
lines changed

packages/platform/src/app/App.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AppUser } from './core/store';
1+
import type { AppTheme, AppUser } from './utils/types';
22
import type { DRootProps } from '@react-devui/ui';
33
import type { DLang } from '@react-devui/ui/utils/types';
44

@@ -14,15 +14,13 @@ import { AppRoutes } from './Routes';
1414
import { STORAGE_KEY } from './config/storage';
1515
import { GlobalStore, TOKEN, useHttp, useInit } from './core';
1616

17-
export type AppTheme = 'light' | 'dark';
18-
1917
export function App() {
2018
const http = useHttp();
2119
const init = useInit();
2220
const async = useAsync();
23-
const [loading, setLoading] = useState(!isNull(TOKEN.value));
2421
const languageStorage = useStorage<DLang>(...STORAGE_KEY.language);
2522
const themeStorage = useStorage<AppTheme>(...STORAGE_KEY.theme);
23+
const [loading, setLoading] = useState(!isNull(TOKEN.value));
2624
const [{ dialogs, notifications, toasts }] = useStore(GlobalStore, ['dialogs', 'notifications', 'toasts']);
2725

2826
useMount(() => {

packages/platform/src/app/components/chart/Chart.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AppTheme } from '../../App';
1+
import type { AppTheme } from '../../utils/types';
22

33
import * as echarts from 'echarts';
44
import { cloneDeep, merge } from 'lodash';

packages/platform/src/app/components/map/Map.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AppTheme } from '../../App';
1+
import type { AppTheme } from '../../utils/types';
22

33
import { isUndefined } from 'lodash';
44
import React, { useEffect, useImperativeHandle, useRef, useState } from 'react';

packages/platform/src/app/core/http/mock.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
import type { DeviceDoc } from '../../utils/types';
2-
import type { AppNotification, AppUser } from '../store';
1+
import type { AppNotification, AppUser, DeviceDoc } from '../../utils/types';
32
import type { JWTToken, JWTTokenPayload } from '../token';
43

54
import axios from 'axios';

packages/platform/src/app/core/store.ts

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,8 @@
1+
import type { AppUser, AppNotification, AppMenu } from '../utils/types';
12
import type { DNotificationProps, DToastProps } from '@react-devui/ui';
23

34
import { createStore } from 'rcl-store';
45

5-
export interface AppUser {
6-
name: string;
7-
avatar?: string;
8-
permission: (string | number)[];
9-
}
10-
11-
export interface AppNotification {
12-
id: string;
13-
title: string;
14-
list: {
15-
message: string;
16-
read: boolean;
17-
}[];
18-
}
19-
20-
export interface AppMenu {
21-
expands?: string[];
22-
}
23-
246
export const GlobalStore = createStore<{
257
appUser: AppUser;
268
appNotifications: AppNotification[] | undefined;

packages/platform/src/app/core/useInit.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AppNotification, AppUser } from './store';
1+
import type { AppNotification, AppUser } from '../utils/types';
22

33
import { isNull } from 'lodash';
44

packages/platform/src/app/routes/layout/header/Header.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { AppTheme } from '../../../App';
1+
import type { AppTheme } from '../../../utils/types';
22

33
import { useEffect, useRef } from 'react';
44
import { useTranslation } from 'react-i18next';

packages/platform/src/app/routes/login/Login.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type { PREV_ROUTE_KEY } from '../../config/other';
2-
import type { AppUser } from '../../core/store';
2+
import type { AppUser } from '../../utils/types';
33

44
import { isString } from 'lodash';
55
import { useEffect, useState } from 'react';

packages/platform/src/app/utils/types.ts

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
export type AppTheme = 'light' | 'dark';
2+
3+
export interface AppUser {
4+
name: string;
5+
avatar?: string;
6+
permission: (string | number)[];
7+
}
8+
9+
export interface AppNotification {
10+
id: string;
11+
title: string;
12+
list: {
13+
message: string;
14+
read: boolean;
15+
}[];
16+
}
17+
18+
export interface AppMenu {
19+
expands?: string[];
20+
}
21+
122
export interface StandardQueryParams {
223
sort?: string;
324
page?: number;

0 commit comments

Comments
 (0)