@zhang_libo/resource-hub 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.en.md +80 -0
- package/README.ja.md +80 -0
- package/README.md +79 -0
- package/README.zh-TW.md +80 -0
- package/bin/cli.js +10 -0
- package/dist/app.d.ts +2 -0
- package/dist/app.d.ts.map +1 -0
- package/dist/app.js +59 -0
- package/dist/app.js.map +1 -0
- package/dist/db/index.js +12 -0
- package/dist/db/index.js.map +1 -0
- package/dist/db/migrate.d.ts +3 -0
- package/dist/db/migrate.d.ts.map +1 -0
- package/dist/db/migrate.js +169 -0
- package/dist/db/migrate.js.map +1 -0
- package/dist/db/schema.d.ts +743 -0
- package/dist/db/schema.d.ts.map +1 -0
- package/dist/db/schema.js +88 -0
- package/dist/db/schema.js.map +1 -0
- package/dist/i18n.js +309 -0
- package/dist/i18n.js.map +1 -0
- package/dist/plugins/admin.d.ts +4 -0
- package/dist/plugins/admin.d.ts.map +1 -0
- package/dist/plugins/admin.js +19 -0
- package/dist/plugins/admin.js.map +1 -0
- package/dist/plugins/auth.d.ts +4 -0
- package/dist/plugins/auth.d.ts.map +1 -0
- package/dist/plugins/auth.js +35 -0
- package/dist/plugins/auth.js.map +1 -0
- package/dist/routes/auth.d.ts +4 -0
- package/dist/routes/auth.d.ts.map +1 -0
- package/dist/routes/auth.js +352 -0
- package/dist/routes/auth.js.map +1 -0
- package/dist/routes/categories.d.ts +4 -0
- package/dist/routes/categories.d.ts.map +1 -0
- package/dist/routes/categories.js +112 -0
- package/dist/routes/categories.js.map +1 -0
- package/dist/routes/config.d.ts +4 -0
- package/dist/routes/config.d.ts.map +1 -0
- package/dist/routes/config.js +227 -0
- package/dist/routes/config.js.map +1 -0
- package/dist/routes/resources.d.ts +4 -0
- package/dist/routes/resources.d.ts.map +1 -0
- package/dist/routes/resources.js +474 -0
- package/dist/routes/resources.js.map +1 -0
- package/dist/routes/tags.d.ts +4 -0
- package/dist/routes/tags.d.ts.map +1 -0
- package/dist/routes/tags.js +37 -0
- package/dist/routes/tags.js.map +1 -0
- package/dist/routes/users.d.ts +4 -0
- package/dist/routes/users.d.ts.map +1 -0
- package/dist/routes/users.js +181 -0
- package/dist/routes/users.js.map +1 -0
- package/dist/services/crypto.js +49 -0
- package/dist/services/crypto.js.map +1 -0
- package/dist/services/mail.d.ts +16 -0
- package/dist/services/mail.d.ts.map +1 -0
- package/dist/services/mail.js +33 -0
- package/dist/services/mail.js.map +1 -0
- package/dist/services/rsa.js +49 -0
- package/dist/services/rsa.js.map +1 -0
- package/dist/services/token.d.ts +9 -0
- package/dist/services/token.d.ts.map +1 -0
- package/dist/services/token.js +29 -0
- package/dist/services/token.js.map +1 -0
- package/dist/types.d.ts +80 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +73 -0
- package/public/admin/AdminCategories.jsx +310 -0
- package/public/admin/AdminConfig.jsx +254 -0
- package/public/admin/AdminEmail.jsx +279 -0
- package/public/admin/AdminTags.jsx +263 -0
- package/public/admin/AdminUsers.jsx +452 -0
- package/public/app.jsx +186 -0
- package/public/components/ConfirmDialog.jsx +78 -0
- package/public/components/DropdownSelect.jsx +281 -0
- package/public/components/EmailPreviewModal.jsx +104 -0
- package/public/components/EmptyState.jsx +50 -0
- package/public/components/Modal.jsx +127 -0
- package/public/components/PasswordStrength.jsx +45 -0
- package/public/components/Skeleton.jsx +68 -0
- package/public/components/Toast.jsx +80 -0
- package/public/components/TooltipIconButton.jsx +55 -0
- package/public/context/AppContext.jsx +314 -0
- package/public/features/BatchResourceModal.jsx +606 -0
- package/public/features/ChangePasswordModal.jsx +187 -0
- package/public/features/ProfileModal.jsx +170 -0
- package/public/features/ResourceCard.jsx +422 -0
- package/public/features/ResourceFormModal.jsx +915 -0
- package/public/features/ResourceRow.jsx +287 -0
- package/public/features/ResourceTimeline.jsx +472 -0
- package/public/hooks/useApi.jsx +26 -0
- package/public/hooks/useRouter.jsx +35 -0
- package/public/index.html +258 -0
- package/public/layout/AdminLayout.jsx +167 -0
- package/public/layout/AppLayout.jsx +119 -0
- package/public/layout/AuthLayout.jsx +503 -0
- package/public/layout/Header.jsx +543 -0
- package/public/layout/Sidebar.jsx +175 -0
- package/public/pages/AdminPage.jsx +30 -0
- package/public/pages/ForgotPasswordPage.jsx +93 -0
- package/public/pages/HomePage.jsx +2297 -0
- package/public/pages/LoginPage.jsx +191 -0
- package/public/pages/RegisterPage.jsx +137 -0
- package/public/pages/ResetPasswordPage.jsx +169 -0
- package/public/pages/SetupPage.jsx +157 -0
- package/public/utils/helpers.jsx +152 -0
- package/public/utils/i18n.jsx +1374 -0
- package/public/utils/preferences.jsx +220 -0
- package/public/utils/security.jsx +88 -0
- package/public/utils/theme.jsx +24 -0
- package/public/vendor/babel.min.js +2 -0
- package/public/vendor/lucide-react.min.js +9 -0
- package/public/vendor/react-dom.development.js +29869 -0
- package/public/vendor/react.development.js +3342 -0
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
function ChangePasswordModal({ isOpen, onClose }) {
|
|
2
|
+
const state = window.useAppState();
|
|
3
|
+
const dispatch = window.useAppDispatch();
|
|
4
|
+
const { request } = window.useApi();
|
|
5
|
+
const currentUser = state?.currentUser;
|
|
6
|
+
|
|
7
|
+
const [form, setForm] = React.useState({ currentPassword: '', newPassword: '', confirmPassword: '' });
|
|
8
|
+
const [errors, setErrors] = React.useState({});
|
|
9
|
+
const [loading, setLoading] = React.useState(false);
|
|
10
|
+
const [showFields, setShowFields] = React.useState({ current: false, new: false, confirm: false });
|
|
11
|
+
|
|
12
|
+
React.useEffect(() => {
|
|
13
|
+
if (isOpen) {
|
|
14
|
+
setForm({ currentPassword: '', newPassword: '', confirmPassword: '' });
|
|
15
|
+
setErrors({});
|
|
16
|
+
setShowFields({ current: false, new: false, confirm: false });
|
|
17
|
+
}
|
|
18
|
+
}, [isOpen]);
|
|
19
|
+
|
|
20
|
+
const validate = () => {
|
|
21
|
+
const errs = {};
|
|
22
|
+
if (!form.currentPassword)
|
|
23
|
+
errs.currentPassword = '请输入当前密码';
|
|
24
|
+
if (form.newPassword.length < 8 || !/[a-zA-Z]/.test(form.newPassword) || !/[0-9]/.test(form.newPassword))
|
|
25
|
+
errs.newPassword = '新密码至少8位,需包含字母和数字';
|
|
26
|
+
else if (form.newPassword === form.currentPassword)
|
|
27
|
+
errs.newPassword = '新密码不能与当前密码相同';
|
|
28
|
+
if (form.newPassword !== form.confirmPassword)
|
|
29
|
+
errs.confirmPassword = '两次密码不一致';
|
|
30
|
+
return errs;
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const handleSubmit = async () => {
|
|
34
|
+
const errs = validate();
|
|
35
|
+
if (Object.keys(errs).length > 0) { setErrors(errs); return; }
|
|
36
|
+
setLoading(true);
|
|
37
|
+
try {
|
|
38
|
+
const { passwordEnc: currentPasswordEnc, ts } = await window.security.encryptPasswordWithTs(form.currentPassword);
|
|
39
|
+
const { passwordEnc: newPasswordEnc } = await window.security.encryptPasswordWithTs(form.newPassword);
|
|
40
|
+
const { ok, data } = await request('/api/auth/me/password', {
|
|
41
|
+
method: 'PUT',
|
|
42
|
+
body: JSON.stringify({
|
|
43
|
+
currentPasswordEnc,
|
|
44
|
+
newPasswordEnc,
|
|
45
|
+
ts,
|
|
46
|
+
}),
|
|
47
|
+
});
|
|
48
|
+
if (ok) {
|
|
49
|
+
dispatch({ type: 'ADD_TOAST', toastType: 'success', message: '密码已修改' });
|
|
50
|
+
onClose();
|
|
51
|
+
} else {
|
|
52
|
+
if (data.code === 'WRONG_PASSWORD') {
|
|
53
|
+
setErrors({ currentPassword: '当前密码错误' });
|
|
54
|
+
} else if (data.code === 'VALIDATION_ERROR' && data.fields) {
|
|
55
|
+
setErrors(data.fields);
|
|
56
|
+
}
|
|
57
|
+
dispatch({ type: 'ADD_TOAST', toastType: 'error', message: data.error || '修改失败' });
|
|
58
|
+
}
|
|
59
|
+
} finally {
|
|
60
|
+
setLoading(false);
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const PasswordField = ({ field, label, showKey, placeholder, autoComplete }) => (
|
|
65
|
+
<div style={{ marginBottom: '14px' }}>
|
|
66
|
+
<label style={{
|
|
67
|
+
fontSize: '13px', fontWeight: 500, color: 'var(--text-primary)',
|
|
68
|
+
display: 'block', marginBottom: '6px',
|
|
69
|
+
}}>
|
|
70
|
+
{label}
|
|
71
|
+
</label>
|
|
72
|
+
<div style={{ position: 'relative' }}>
|
|
73
|
+
<input
|
|
74
|
+
type={showFields[showKey] ? 'text' : 'password'}
|
|
75
|
+
name={field}
|
|
76
|
+
autoComplete={autoComplete}
|
|
77
|
+
value={form[field]}
|
|
78
|
+
placeholder={placeholder}
|
|
79
|
+
onChange={e => setForm(f => ({ ...f, [field]: e.target.value }))}
|
|
80
|
+
onKeyDown={e => { if (e.key === 'Enter') handleSubmit(); }}
|
|
81
|
+
disabled={loading}
|
|
82
|
+
style={{
|
|
83
|
+
width: '100%', padding: '8px 40px 8px 12px',
|
|
84
|
+
border: `1px solid ${errors[field] ? 'var(--danger)' : 'var(--border)'}`,
|
|
85
|
+
borderRadius: '8px', background: 'var(--bg-secondary)',
|
|
86
|
+
color: 'var(--text-primary)', fontSize: '14px',
|
|
87
|
+
outline: 'none', boxSizing: 'border-box',
|
|
88
|
+
}}
|
|
89
|
+
/>
|
|
90
|
+
<button
|
|
91
|
+
type="button"
|
|
92
|
+
onClick={() => setShowFields(s => ({ ...s, [showKey]: !s[showKey] }))}
|
|
93
|
+
style={{
|
|
94
|
+
position: 'absolute', right: '10px', top: '50%', transform: 'translateY(-50%)',
|
|
95
|
+
background: 'none', border: 'none', cursor: 'pointer',
|
|
96
|
+
color: 'var(--text-secondary)', display: 'flex', alignItems: 'center',
|
|
97
|
+
}}
|
|
98
|
+
>
|
|
99
|
+
{showFields[showKey] ? <lucide.EyeOff size={16} /> : <lucide.Eye size={16} />}
|
|
100
|
+
</button>
|
|
101
|
+
</div>
|
|
102
|
+
{field === 'newPassword' && (
|
|
103
|
+
<window.PasswordStrength password={form.newPassword} />
|
|
104
|
+
)}
|
|
105
|
+
{errors[field] && (
|
|
106
|
+
<div style={{ fontSize: '12px', color: 'var(--danger)', marginTop: '4px' }}>{errors[field]}</div>
|
|
107
|
+
)}
|
|
108
|
+
</div>
|
|
109
|
+
);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<window.Modal isOpen={isOpen} onClose={onClose} title="修改密码" width="440px" closeOnBackdrop={false} closeOnEscape>
|
|
113
|
+
<form onSubmit={(e) => { e.preventDefault(); handleSubmit(); }}>
|
|
114
|
+
<input
|
|
115
|
+
type="text"
|
|
116
|
+
name="username"
|
|
117
|
+
autoComplete="username"
|
|
118
|
+
value={currentUser?.username || currentUser?.email || ''}
|
|
119
|
+
readOnly
|
|
120
|
+
tabIndex={-1}
|
|
121
|
+
style={{
|
|
122
|
+
position: 'absolute',
|
|
123
|
+
opacity: 0,
|
|
124
|
+
pointerEvents: 'none',
|
|
125
|
+
width: '1px',
|
|
126
|
+
height: '1px',
|
|
127
|
+
}}
|
|
128
|
+
/>
|
|
129
|
+
<PasswordField
|
|
130
|
+
field="currentPassword"
|
|
131
|
+
label="当前密码"
|
|
132
|
+
showKey="current"
|
|
133
|
+
placeholder="请输入当前密码"
|
|
134
|
+
autoComplete="current-password"
|
|
135
|
+
/>
|
|
136
|
+
<PasswordField
|
|
137
|
+
field="newPassword"
|
|
138
|
+
label="新密码"
|
|
139
|
+
showKey="new"
|
|
140
|
+
placeholder="至少8位,含字母和数字"
|
|
141
|
+
autoComplete="new-password"
|
|
142
|
+
/>
|
|
143
|
+
<PasswordField
|
|
144
|
+
field="confirmPassword"
|
|
145
|
+
label="确认新密码"
|
|
146
|
+
showKey="confirm"
|
|
147
|
+
placeholder="再次输入新密码"
|
|
148
|
+
autoComplete="new-password"
|
|
149
|
+
/>
|
|
150
|
+
|
|
151
|
+
<div style={{
|
|
152
|
+
display: 'flex', gap: '8px', justifyContent: 'flex-end',
|
|
153
|
+
marginTop: '8px', paddingTop: '16px', borderTop: '1px solid var(--border)',
|
|
154
|
+
}}>
|
|
155
|
+
<button
|
|
156
|
+
type="button"
|
|
157
|
+
onClick={onClose}
|
|
158
|
+
disabled={loading}
|
|
159
|
+
style={{
|
|
160
|
+
padding: '8px 20px', border: '1px solid var(--border)',
|
|
161
|
+
background: 'var(--bg-secondary)', color: 'var(--text-primary)',
|
|
162
|
+
borderRadius: '8px', cursor: 'pointer', fontSize: '14px',
|
|
163
|
+
}}
|
|
164
|
+
>
|
|
165
|
+
取消
|
|
166
|
+
</button>
|
|
167
|
+
<button
|
|
168
|
+
type="submit"
|
|
169
|
+
disabled={loading}
|
|
170
|
+
style={{
|
|
171
|
+
padding: '8px 20px', background: 'var(--brand)', color: '#fff',
|
|
172
|
+
border: 'none', borderRadius: '8px',
|
|
173
|
+
cursor: loading ? 'not-allowed' : 'pointer',
|
|
174
|
+
fontSize: '14px', fontWeight: 500, opacity: loading ? 0.8 : 1,
|
|
175
|
+
display: 'flex', alignItems: 'center', gap: '6px',
|
|
176
|
+
}}
|
|
177
|
+
>
|
|
178
|
+
{loading && <lucide.Loader size={14} />}
|
|
179
|
+
确认修改
|
|
180
|
+
</button>
|
|
181
|
+
</div>
|
|
182
|
+
</form>
|
|
183
|
+
</window.Modal>
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
window.ChangePasswordModal = ChangePasswordModal;
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
function ProfileModal({ isOpen, onClose }) {
|
|
2
|
+
const state = window.useAppState();
|
|
3
|
+
const dispatch = window.useAppDispatch();
|
|
4
|
+
const { request } = window.useApi();
|
|
5
|
+
|
|
6
|
+
const currentUser = state?.currentUser;
|
|
7
|
+
const [form, setForm] = React.useState({ displayName: '', email: '' });
|
|
8
|
+
const [errors, setErrors] = React.useState({});
|
|
9
|
+
const [loading, setLoading] = React.useState(false);
|
|
10
|
+
|
|
11
|
+
React.useEffect(() => {
|
|
12
|
+
if (isOpen && currentUser) {
|
|
13
|
+
setForm({
|
|
14
|
+
displayName: currentUser.displayName || '',
|
|
15
|
+
email: currentUser.email || '',
|
|
16
|
+
});
|
|
17
|
+
setErrors({});
|
|
18
|
+
}
|
|
19
|
+
}, [isOpen, currentUser?.id]);
|
|
20
|
+
|
|
21
|
+
const validate = () => {
|
|
22
|
+
const errs = {};
|
|
23
|
+
if (!form.displayName || form.displayName.trim().length === 0 || form.displayName.length > 30)
|
|
24
|
+
errs.displayName = '显示名称不能为空(最多30字符)';
|
|
25
|
+
if (!/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(form.email))
|
|
26
|
+
errs.email = '请输入有效的邮箱地址';
|
|
27
|
+
return errs;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const handleSave = async () => {
|
|
31
|
+
const errs = validate();
|
|
32
|
+
if (Object.keys(errs).length > 0) { setErrors(errs); return; }
|
|
33
|
+
setLoading(true);
|
|
34
|
+
try {
|
|
35
|
+
const { ok, data } = await request('/api/auth/me', {
|
|
36
|
+
method: 'PUT',
|
|
37
|
+
body: JSON.stringify({ displayName: form.displayName.trim(), email: form.email.trim() }),
|
|
38
|
+
});
|
|
39
|
+
if (ok) {
|
|
40
|
+
dispatch({ type: 'SET_CURRENT_USER', user: { ...currentUser, ...data.data } });
|
|
41
|
+
dispatch({ type: 'ADD_TOAST', toastType: 'success', message: '保存成功' });
|
|
42
|
+
onClose();
|
|
43
|
+
} else {
|
|
44
|
+
dispatch({ type: 'ADD_TOAST', toastType: 'error', message: data.error || '保存失败' });
|
|
45
|
+
}
|
|
46
|
+
} finally {
|
|
47
|
+
setLoading(false);
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
if (!currentUser) return null;
|
|
52
|
+
|
|
53
|
+
const { formatDate } = window.helpers;
|
|
54
|
+
|
|
55
|
+
const inputStyle = (field) => ({
|
|
56
|
+
width: '100%', padding: '8px 12px',
|
|
57
|
+
border: `1px solid ${(errors && errors[field]) ? 'var(--danger)' : 'var(--border)'}`,
|
|
58
|
+
borderRadius: '8px', background: 'var(--bg-secondary)',
|
|
59
|
+
color: 'var(--text-primary)', fontSize: '14px',
|
|
60
|
+
outline: 'none', boxSizing: 'border-box',
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
const readOnlyStyle = {
|
|
64
|
+
width: '100%', padding: '8px 12px',
|
|
65
|
+
border: '1px solid var(--border)',
|
|
66
|
+
borderRadius: '8px',
|
|
67
|
+
background: 'var(--bg-primary)',
|
|
68
|
+
color: 'var(--text-secondary)',
|
|
69
|
+
fontSize: '14px',
|
|
70
|
+
outline: 'none',
|
|
71
|
+
boxSizing: 'border-box',
|
|
72
|
+
cursor: 'not-allowed',
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const labelStyle = {
|
|
76
|
+
fontSize: '13px', fontWeight: 500, color: 'var(--text-primary)',
|
|
77
|
+
display: 'block', marginBottom: '6px',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
return (
|
|
81
|
+
<window.Modal isOpen={isOpen} onClose={onClose} title="个人信息" width="480px" closeOnBackdrop={false} closeOnEscape>
|
|
82
|
+
<div>
|
|
83
|
+
{/* Read-only fields */}
|
|
84
|
+
<div style={{ marginBottom: '14px' }}>
|
|
85
|
+
<label style={labelStyle}>用户名</label>
|
|
86
|
+
<input value={currentUser.username || ''} readOnly style={readOnlyStyle} />
|
|
87
|
+
</div>
|
|
88
|
+
|
|
89
|
+
<div style={{ marginBottom: '14px' }}>
|
|
90
|
+
<label style={labelStyle}>角色</label>
|
|
91
|
+
<input
|
|
92
|
+
value={currentUser.role === 'admin' ? '管理员' : '普通用户'}
|
|
93
|
+
readOnly
|
|
94
|
+
style={readOnlyStyle}
|
|
95
|
+
/>
|
|
96
|
+
</div>
|
|
97
|
+
|
|
98
|
+
<div style={{ marginBottom: '14px' }}>
|
|
99
|
+
<label style={labelStyle}>注册时间</label>
|
|
100
|
+
<input value={formatDate(currentUser.createdAt)} readOnly style={readOnlyStyle} />
|
|
101
|
+
</div>
|
|
102
|
+
|
|
103
|
+
{/* Editable: displayName */}
|
|
104
|
+
<div style={{ marginBottom: '14px' }}>
|
|
105
|
+
<label style={labelStyle}>显示名称</label>
|
|
106
|
+
<input
|
|
107
|
+
value={form.displayName}
|
|
108
|
+
onChange={e => setForm(f => ({ ...f, displayName: e.target.value }))}
|
|
109
|
+
style={inputStyle('displayName')}
|
|
110
|
+
disabled={loading}
|
|
111
|
+
maxLength={30}
|
|
112
|
+
placeholder="请输入显示名称"
|
|
113
|
+
/>
|
|
114
|
+
{errors.displayName && (
|
|
115
|
+
<div style={{ fontSize: '12px', color: 'var(--danger)', marginTop: '4px' }}>{errors.displayName}</div>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
{/* Editable: email */}
|
|
120
|
+
<div style={{ marginBottom: '14px' }}>
|
|
121
|
+
<label style={labelStyle}>邮箱</label>
|
|
122
|
+
<input
|
|
123
|
+
value={form.email}
|
|
124
|
+
onChange={e => setForm(f => ({ ...f, email: e.target.value }))}
|
|
125
|
+
style={inputStyle('email')}
|
|
126
|
+
disabled={loading}
|
|
127
|
+
type="email"
|
|
128
|
+
placeholder="请输入邮箱地址"
|
|
129
|
+
/>
|
|
130
|
+
{errors.email && (
|
|
131
|
+
<div style={{ fontSize: '12px', color: 'var(--danger)', marginTop: '4px' }}>{errors.email}</div>
|
|
132
|
+
)}
|
|
133
|
+
</div>
|
|
134
|
+
|
|
135
|
+
{/* Footer */}
|
|
136
|
+
<div style={{
|
|
137
|
+
display: 'flex', gap: '8px', justifyContent: 'flex-end',
|
|
138
|
+
marginTop: '8px', paddingTop: '16px', borderTop: '1px solid var(--border)',
|
|
139
|
+
}}>
|
|
140
|
+
<button
|
|
141
|
+
onClick={onClose}
|
|
142
|
+
style={{
|
|
143
|
+
padding: '8px 20px', border: '1px solid var(--border)',
|
|
144
|
+
background: 'var(--bg-secondary)', color: 'var(--text-primary)',
|
|
145
|
+
borderRadius: '8px', cursor: 'pointer', fontSize: '14px',
|
|
146
|
+
}}
|
|
147
|
+
>
|
|
148
|
+
关闭
|
|
149
|
+
</button>
|
|
150
|
+
<button
|
|
151
|
+
onClick={handleSave}
|
|
152
|
+
disabled={loading}
|
|
153
|
+
style={{
|
|
154
|
+
padding: '8px 20px', background: 'var(--brand)', color: '#fff',
|
|
155
|
+
border: 'none', borderRadius: '8px',
|
|
156
|
+
cursor: loading ? 'not-allowed' : 'pointer',
|
|
157
|
+
fontSize: '14px', fontWeight: 500, opacity: loading ? 0.8 : 1,
|
|
158
|
+
display: 'flex', alignItems: 'center', gap: '6px',
|
|
159
|
+
}}
|
|
160
|
+
>
|
|
161
|
+
{loading && <lucide.Loader size={14} />}
|
|
162
|
+
保存修改
|
|
163
|
+
</button>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</window.Modal>
|
|
167
|
+
);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
window.ProfileModal = ProfileModal;
|