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