mirror of
https://github.com/ragestudio/comty.git
synced 2025-06-10 02:54:15 +00:00
generate settings reading files
This commit is contained in:
parent
a5d7266177
commit
1fa52ae9f5
@ -1,22 +1,26 @@
|
||||
import GeneralSettings from "./general"
|
||||
import ProfileSettings from "./profile"
|
||||
import SecuritySettings from "./security"
|
||||
import NotificationsSettings from "./notifications"
|
||||
import ApparenceSettings from "./apparence"
|
||||
import ExtensionsSettings from "./extensions"
|
||||
import SyncSettings from "./sync"
|
||||
import PlayerSettings from "./player"
|
||||
const settingsPaths = import.meta.glob("/constants/settings/*/index.jsx")
|
||||
|
||||
import AboutPage from "./about"
|
||||
export default async () => {
|
||||
const settings = {}
|
||||
|
||||
export default {
|
||||
general: GeneralSettings,
|
||||
profile: ProfileSettings,
|
||||
apparence: ApparenceSettings,
|
||||
player: PlayerSettings,
|
||||
security: SecuritySettings,
|
||||
notifications: NotificationsSettings,
|
||||
extensions: ExtensionsSettings,
|
||||
sync: SyncSettings,
|
||||
about: AboutPage,
|
||||
for (const [key, value] of Object.entries(settingsPaths)) {
|
||||
const path = key.split("/").slice(-2)
|
||||
const name = path[0]
|
||||
|
||||
if (name === "components" || name === "index") {
|
||||
continue
|
||||
}
|
||||
|
||||
if (!settings[name]) {
|
||||
settings[name] = {}
|
||||
}
|
||||
|
||||
let setting = await value()
|
||||
|
||||
setting = setting.default || setting
|
||||
|
||||
settings[name] = setting
|
||||
}
|
||||
|
||||
return settings
|
||||
}
|
@ -6,10 +6,12 @@ import classnames from "classnames"
|
||||
|
||||
import { Icons, createIconRender } from "components/Icons"
|
||||
|
||||
import SettingsList from "schemas/settings"
|
||||
import getSettingsList from "schemas/settings"
|
||||
import menuGroupsDecorators from "schemas/settingsMenuGroupsDecorators"
|
||||
import groupsDecorators from "schemas/settingsGroupsDecorators"
|
||||
|
||||
const SettingsList = await getSettingsList()
|
||||
|
||||
import "./index.less"
|
||||
|
||||
const ItemTypes = {
|
||||
@ -477,7 +479,7 @@ const generateMenuItems = () => {
|
||||
})
|
||||
}
|
||||
|
||||
export default React.memo(() => {
|
||||
export default () => {
|
||||
const [activeKey, setActiveKey] = React.useState("general")
|
||||
const [menuItems, setMenuItems] = React.useState([])
|
||||
|
||||
@ -515,4 +517,4 @@ export default React.memo(() => {
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
})
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user