Skip to content

Commit 1888f80

Browse files
committed
feat: add data generater for base64
1 parent 127adf4 commit 1888f80

File tree

23 files changed

+86
-17
lines changed

23 files changed

+86
-17
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
/tmp
66
/out-tsc
77
/tools-dist
8+
base64.out.ts
89

910
# dependencies
1011
/node_modules

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"publish:vscode-extension": "yarn build:vscode-extension && cd dist/packages/vscode-extension && vsce publish --yarn",
1818
"serve:site": "nx serve site",
1919
"test:affected": "nx affected --target=test --parallel=7",
20+
"util:base64-data": "ts-node -P ./tools/tsconfig.json ./tools/base64-data.ts",
2021
"util:check-update": "yarn upgrade-interactive --latest",
2122
"util:sort-package-json": "sort-package-json 'package.json' 'packages/*/package.json'",
2223
"util:update-dependencies": "ts-node -P ./tools/tsconfig.json ./tools/update-dependencies.ts",

packages/platform/project.json

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,12 @@
44
"projectType": "application",
55
"tags": ["scope:platform"],
66
"targets": {
7+
"build-dependencies": {
8+
"executor": "nx:run-commands",
9+
"options": {
10+
"commands": ["yarn util:base64-data"]
11+
}
12+
},
713
"build": {
814
"executor": "@nrwl/webpack:webpack",
915
"outputs": ["{options.outputPath}"],
@@ -35,15 +41,27 @@
3541
"extractLicenses": true,
3642
"vendorChunk": false
3743
}
38-
}
44+
},
45+
"dependsOn": [
46+
{
47+
"target": "build-dependencies",
48+
"projects": "self"
49+
}
50+
]
3951
},
4052
"serve": {
4153
"executor": "@nrwl/webpack:dev-server",
4254
"options": {
4355
"buildTarget": "platform:build",
4456
"port": 4310,
4557
"open": true
46-
}
58+
},
59+
"dependsOn": [
60+
{
61+
"target": "build-dependencies",
62+
"projects": "self"
63+
}
64+
]
4765
},
4866
"lint": {
4967
"executor": "@nrwl/linter:eslint",
File renamed without changes.
File renamed without changes.
File renamed without changes.

packages/platform/src/app/routes/exception/Exception.module.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@
2727
}
2828

2929
@include e(bg) {
30+
flex-shrink: 0;
3031
width: calc(100% - 40px);
3132
max-width: 320px;
3233
}

packages/platform/src/app/routes/exception/Exception.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,14 @@
1+
import React from 'react';
12
import { useTranslation } from 'react-i18next';
23
import { useNavigate } from 'react-router-dom';
34

45
import { DButton } from '@react-devui/ui';
56
import { getClassName } from '@react-devui/utils';
67

78
import { useDeviceQuery } from '../../hooks';
9+
import { ReactComponent as S403 } from './403.svg';
10+
import { ReactComponent as S404 } from './404.svg';
11+
import { ReactComponent as S500 } from './500.svg';
812
import styles from './Exception.module.scss';
913

1014
export default function Exception(props: { status: number }): JSX.Element | null {
@@ -19,7 +23,7 @@ export default function Exception(props: { status: number }): JSX.Element | null
1923
[styles['app-exception--phone']]: deviceMatched === 'phone',
2024
})}
2125
>
22-
<img className={styles['app-exception__bg']} src={`/assets/${status}.svg`} alt="bg" />
26+
{React.createElement(status === 403 ? S403 : status === 404 ? S404 : S500, { className: styles['app-exception__bg'] })}
2327
<div className={styles['app-exception__info']}>
2428
<div className={styles['app-exception__status']}>{status}</div>
2529
<div className={styles['app-exception__description']}>{t(`routes.exception.${status}`)}</div>

packages/platform/src/app/routes/layout/header/notification/Notification.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export function AppNotification(props: React.ButtonHTMLAttributes<HTMLButtonElem
4545
panel: (
4646
<AppList
4747
aList={notify.list.map((item) => ({
48-
avatar: <DAvatar dImg={{ src: '/assets/avatar.png', alt: 'avatar' }}></DAvatar>,
48+
avatar: <DAvatar dImg={{ src: '/assets/imgs/avatar.png', alt: 'avatar' }}></DAvatar>,
4949
title: 'name',
5050
description: item.message,
5151
props: {

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { useHttp, useInit } from '../../../core';
1515
import { AppLanguage } from '../../components';
1616
import { useDeviceQuery } from '../../hooks';
1717
import styles from './Login.module.scss';
18+
import { BASE64_DATA } from './base64.out';
1819

1920
export default function Login(): JSX.Element | null {
2021
const { t } = useTranslation();
@@ -101,7 +102,9 @@ export default function Login(): JSX.Element | null {
101102
<div className={styles['app-login']}>
102103
<AppLanguage className={styles['app-login__lang']} />
103104
<div>
104-
{deviceMatched === 'desktop' && <img className={styles['app-login__bg']} src="/assets/login-bg.png" alt="bg" />}
105+
{deviceMatched === 'desktop' && (
106+
<img className={styles['app-login__bg']} src={`data:image/png;base64,${BASE64_DATA.bg}`} alt="bg" />
107+
)}
105108
<div className={styles['app-login__login-container']}>
106109
<div className={styles['app-login__title-container']}>
107110
<img className={styles['app-login__logo']} src="/assets/logo.svg" alt="Logo" />

0 commit comments

Comments
 (0)