Skip to content

Commit

Permalink
feat: add react compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
ahyiru committed Jun 26, 2024
1 parent 6cabd91 commit 2d76ab6
Show file tree
Hide file tree
Showing 93 changed files with 3,070 additions and 2,557 deletions.
4 changes: 2 additions & 2 deletions .huxy/app.configs.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ const app = {
projectName: '...',
PROXY: [
/* {
url: 'http://api.ihuxy.com',
url: 'https://api.ihuxy.com',
prefix: '/huxyapi',
pathRewrite: {'^/huxyapi': ''},
}, */
{
url: 'https://ihuxy.com',
url: 'http://ihuxy.com:9202',
prefix: '/huxyapi',
},
{
Expand Down
2 changes: 1 addition & 1 deletion app/apis/report/browserInfo.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getOsInfo, getExplore} from '@huxy/utils';
import {browserRouter} from '@app/configs';

import pkg from '../../../package.json';
import pkg from '../../../package.json';

const {type: osType, version: osVersion, model: osModel} = getOsInfo();
const {type: browserType, version: browserVersion} = getExplore();
Expand Down
18 changes: 10 additions & 8 deletions app/apis/socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,17 @@ const wsMsgUrl = `${window.location.origin}/ws-message`;

const wsChatUrl = `${window.location.origin}/ws-chat`;

export const wsMsg = () => io(wsMsgUrl, {
auth: {Authorization: `yiru ${storage.get('token')}`},
// autoConnect: false,
});
export const wsMsg = () =>
io(wsMsgUrl, {
auth: {Authorization: `yiru ${storage.get('token')}`},
// autoConnect: false,
});

export const wsChat = () => io(wsChatUrl, {
auth: {Authorization: `yiru ${storage.get('token')}`},
autoConnect: false,
});
export const wsChat = () =>
io(wsChatUrl, {
auth: {Authorization: `yiru ${storage.get('token')}`},
autoConnect: false,
});

const initWS = () => {
const ws = wsMsg();
Expand Down
6 changes: 4 additions & 2 deletions app/assets/styles.less
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@

.project-list {
display: flex;
.link-list, .path-list {
.link-list,
.path-list {
flex: 1;
padding: 15px;
}
Expand All @@ -62,7 +63,8 @@
}
}
.app-tools {
.app-list, .tool-list {
.app-list,
.tool-list {
display: flex;
padding: 12px 8px;
.link {
Expand Down
2 changes: 1 addition & 1 deletion app/commons/layout/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@
- handleNavClick:导航栏点击事件。
- leftList、rightList:左侧导航栏、右侧导航栏配置。
- logo、title、Link:logo、标题、Link 组件 注入。
- menuAnimate: Boolean | String, 默认 false。
- menuAnimate: Boolean | String, 默认 false。
48 changes: 28 additions & 20 deletions app/commons/layout/components/footer/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,34 @@ import './index.less';

const Index = props => {
const i18ns = getIntls('nav.footer', {});
return <div className="footer-wrap">
<div className="copyright">
<a className="copy" href="https://ihuxy.com">
{i18ns.copy}
</a>
<a className="right" href="https://beian.miit.gov.cn/">
{i18ns.right}
</a>
return (
<div className="footer-wrap">
<div className="copyright">
<a className="copy" href="https://ihuxy.com">
{i18ns.copy}
</a>
<a className="right" href="https://beian.miit.gov.cn/">
{i18ns.right}
</a>
</div>
<ul className="link-list">
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">
{i18ns.about}
</Link>
</li>
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">
{i18ns.team}
</Link>
</li>
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">
{i18ns.contact}
</Link>
</li>
</ul>
</div>
<ul className="link-list">
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">{i18ns.about}</Link>
</li>
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">{i18ns.team}</Link>
</li>
<li>
<Link className="link" target="_blank" to="https://ihuxy.com/md2html?folder=%E5%85%B3%E4%BA%8E%E6%88%91%E4%BB%AC&name=AboutUs">{i18ns.contact}</Link>
</li>
</ul>
</div>;
);
};
export default Index;
3 changes: 2 additions & 1 deletion app/commons/layout/components/footer/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
height: 100%;
overflow: hidden;
padding: 0 var(--frame-spacing);
a, .link {
a,
.link {
padding: 0 6px;
}
.copyright {
Expand Down
8 changes: 4 additions & 4 deletions app/commons/layout/components/menuBottom/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import './index.less';
const Index = ({collapsed, setCollapsed, isSmall}) => {
return (
<div className="menu-collapsed">
{
isSmall ? null : <span
{isSmall ? null : (
<span
className="link collapsed-bar"
onClick={() => {
setCollapsed(!collapsed);
Expand All @@ -24,8 +24,8 @@ const Index = ({collapsed, setCollapsed, isSmall}) => {
>
<Anico type={collapsed ? 'right' : ''} />
</span>
}
{(!isSmall && collapsed) ? null : (
)}
{!isSmall && collapsed ? null : (
<Link
to="https://ihuxy.com/md2html"
target="_blank"
Expand Down
9 changes: 6 additions & 3 deletions app/commons/layout/index.jsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
import {StrictMode} from 'react';
import UiI18n from './components/uiI18n';
import Layout from './layout';

const Index = props => (
<UiI18n>
<Layout {...props} />
</UiI18n>
<StrictMode>
<UiI18n>
<Layout {...props} />
</UiI18n>
</StrictMode>
);

export default Index;
10 changes: 1 addition & 9 deletions app/commons/layout/layout.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,7 @@ const Index = props => {
const i18ns = i18nsStore.getState();
const language = getLang();
const [menus, noHeader] = useFormatMenu(props);
return <Layout
title={i18ns?.title}
{...menus}
leftList={noHeader ? null : leftNav(language)}
rightList={noHeader ? null : rightNav(language)}
{...configs}
{...props}
language={language}
/>;
return <Layout title={i18ns?.title} {...menus} leftList={noHeader ? null : leftNav(language)} rightList={noHeader ? null : rightNav(language)} {...configs} {...props} language={language} />;
};

export default Index;
7 changes: 6 additions & 1 deletion app/commons/styles/common/resets.css
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,12 @@ code {
font-weight: 400;
line-height: 1.7142857;
overflow-x: auto;
font-family: Söhne Mono, Monaco, Andale Mono, Ubuntu Mono, monospace;
font-family:
Söhne Mono,
Monaco,
Andale Mono,
Ubuntu Mono,
monospace;
background: #23241f;
color: #f8f8f2;
}
Expand Down
2 changes: 1 addition & 1 deletion app/commons/styles/common/style-block.less
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
text-overflow: ellipsis;
white-space: nowrap;
width: 100%;
display:inline-block;
display: inline-block;
}

/*清除浮动*/
Expand Down
4 changes: 3 additions & 1 deletion app/commons/styles/common/style-icon.less
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@
left: 50%;
top: 50%;
transform: translateX(-50%) translateY(-50%);
transition: transform var(--anitime), background-color var(--anitime);
transition:
transform var(--anitime),
background-color var(--anitime);

&::before,
&::after {
Expand Down
8 changes: 6 additions & 2 deletions app/commons/styles/func/tooltip.less
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
&::before,
&::after {
opacity: 1;
transition: opacity 0.2s, transform 0.2s;
transition:
opacity 0.2s,
transform 0.2s;
}
&::before {
transform: translateY(0);
Expand All @@ -23,7 +25,9 @@
z-index: 10000;
background-color: @tooltipBgColor;
border: 1px solid @tooltipBorderColor;
transition: opacity 0.2s, transform 0.2s;
transition:
opacity 0.2s,
transform 0.2s;
}

&::before {
Expand Down
17 changes: 11 additions & 6 deletions app/components/base/checkbox/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,17 @@ const Index = ({options, value: selected, onChange, style, ...rest}) => {
return (
<div className="checkbox-wrap" style={{display: 'flex'}}>
{(options || []).map(({value, label}) => (
<div key={value} className="checkbox-item" onClick={e => {
e.stopPropagation();
const index = selected.indexOf(value);
index === -1 ? selected.push(value) : selected.splice(index, 1);
onChange?.(selected, e);
}} style={{display: 'flex', alignItems: 'center', marginRight: '12px', cursor: 'pointer'}}>
<div
key={value}
className="checkbox-item"
onClick={e => {
e.stopPropagation();
const index = selected.indexOf(value);
index === -1 ? selected.push(value) : selected.splice(index, 1);
onChange?.(selected, e);
}}
style={{display: 'flex', alignItems: 'center', marginRight: '12px', cursor: 'pointer'}}
>
<input style={{...style, cursor: 'pointer'}} type="checkbox" value={value} checked={selected.includes(value)} readOnly aria-label={label || value} {...rest} />
<span style={{marginLeft: '6px'}}>{label || value}</span>
</div>
Expand Down
5 changes: 3 additions & 2 deletions app/components/base/input/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
border-color: var(--blue2);
transition: all 0.3s;

& + i, & + span {
& + i,
& + span {
color: var(--blue2);
}
}
Expand All @@ -39,7 +40,7 @@
background-color: #f5f5f5;
cursor: not-allowed;
}

&:invalid {
border-color: var(--red2);
}
Expand Down
68 changes: 34 additions & 34 deletions app/components/custom/table.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -145,16 +145,16 @@ const Index = ({commonprops, ...props}) => {
rowSelection === false || !deleteInfo?.isBatch
? false
: {
selectedRowKeys: selectedRows.map(v => v[rowKey]),
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows);
},
getCheckboxProps: record => ({
disabled: !profile.role && record[rowKey] !== profile[rowKey],
}),
columnWidth: '30px',
...(typeof rowSelection === 'object' ? rowSelection : null),
};
selectedRowKeys: selectedRows.map(v => v[rowKey]),
onChange: (selectedRowKeys, selectedRows) => {
setSelectedRows(selectedRows);
},
getCheckboxProps: record => ({
disabled: !profile.role && record[rowKey] !== profile[rowKey],
}),
columnWidth: '30px',
...(typeof rowSelection === 'object' ? rowSelection : null),
};

const columnsCfg = formatColums(columns, {handleCheck, handleEdit, handleDelete});

Expand All @@ -166,18 +166,18 @@ const Index = ({commonprops, ...props}) => {
pagination === false
? false
: {
onShowSizeChange: (current, size) => pageChange(current, size),
onChange: (current, size) => pageChange(current, size),
showSizeChanger: true,
showQuickJumper: true,
total: total || 1,
current: current || 1,
pageSize: size || 10,
pageSizeOptions: ['10', '20', '30', '40'],
// hideOnSinglePage:true,
size: 'small',
...(typeof pagination === 'object' ? pagination : null),
};
onShowSizeChange: (current, size) => pageChange(current, size),
onChange: (current, size) => pageChange(current, size),
showSizeChanger: true,
showQuickJumper: true,
total: total || 1,
current: current || 1,
pageSize: size || 10,
pageSizeOptions: ['10', '20', '30', '40'],
// hideOnSinglePage:true,
size: 'small',
...(typeof pagination === 'object' ? pagination : null),
};

const searchFormProps = {
submit: values => handleSearch(validObj(values)),
Expand All @@ -192,21 +192,21 @@ const Index = ({commonprops, ...props}) => {

const searchFormSchema = searchSchema
? {
type: 'CustomForm',
props: {
...searchFormProps,
schema: searchSchema,
},
}
type: 'CustomForm',
props: {
...searchFormProps,
schema: searchSchema,
},
}
: null;
const modalFormSchema = modalSchema
? {
type: 'CustomForm',
props: {
...modalFormProps,
schema: modalSchema,
},
}
type: 'CustomForm',
props: {
...modalFormProps,
schema: modalSchema,
},
}
: null;

return (
Expand Down
Loading

0 comments on commit 2d76ab6

Please sign in to comment.