mirror of
https://github.com/aykhans/slash-e.git
synced 2025-04-20 22:07:15 +00:00
chore: update workspace setting fields
This commit is contained in:
parent
b97fb13929
commit
0df3164654
@ -1,5 +1,6 @@
|
||||
import { Option, Select } from "@mui/joy";
|
||||
import { useTranslation } from "react-i18next";
|
||||
import { releaseGuard } from "@/helpers/utils";
|
||||
import { UserSetting, UserSetting_ColorTheme, UserSetting_Locale } from "@/types/proto/api/v2/user_setting_service";
|
||||
import useUserStore from "../../stores/v1/user";
|
||||
import BetaBadge from "../BetaBadge";
|
||||
@ -61,21 +62,23 @@ const PreferenceSection: React.FC = () => {
|
||||
<>
|
||||
<div className="w-full flex flex-col justify-start items-start gap-y-2">
|
||||
<p className="text-base font-semibold leading-6 text-gray-900 dark:text-gray-500">Preference</p>
|
||||
<div className="w-full flex flex-row justify-between items-center">
|
||||
<div className="flex flex-row justify-start items-center gap-x-1">
|
||||
<span className="dark:text-gray-400">{t("common.language")}</span>
|
||||
<BetaBadge />
|
||||
{releaseGuard() && (
|
||||
<div className="w-full flex flex-row justify-between items-center">
|
||||
<div className="flex flex-row justify-start items-center gap-x-1">
|
||||
<span className="dark:text-gray-400">{t("common.language")}</span>
|
||||
<BetaBadge />
|
||||
</div>
|
||||
<Select defaultValue={language} onChange={(_, value) => handleSelectLanguage(value as UserSetting_Locale)}>
|
||||
{languageOptions.map((option) => {
|
||||
return (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
</div>
|
||||
<Select defaultValue={language} onChange={(_, value) => handleSelectLanguage(value as UserSetting_Locale)}>
|
||||
{languageOptions.map((option) => {
|
||||
return (
|
||||
<Option key={option.value} value={option.value}>
|
||||
{option.label}
|
||||
</Option>
|
||||
);
|
||||
})}
|
||||
</Select>
|
||||
</div>
|
||||
)}
|
||||
<div className="w-full flex flex-row justify-between items-center">
|
||||
<div className="flex flex-row justify-start items-center gap-x-1">
|
||||
<span className="dark:text-gray-400">Color Theme</span>
|
||||
|
@ -9,6 +9,7 @@ import { WorkspaceSetting } from "@/types/proto/api/v2/workspace_service";
|
||||
const WorkspaceSection: React.FC = () => {
|
||||
const [workspaceSetting, setWorkspaceSetting] = useState<WorkspaceSetting>(WorkspaceSetting.fromPartial({}));
|
||||
const originalWorkspaceSetting = useRef<WorkspaceSetting>(WorkspaceSetting.fromPartial({}));
|
||||
const allowToSave = !isEqual(originalWorkspaceSetting.current, workspaceSetting);
|
||||
|
||||
useEffect(() => {
|
||||
workspaceServiceClient.getWorkspaceSetting({}).then(({ setting }) => {
|
||||
@ -85,7 +86,7 @@ const WorkspaceSection: React.FC = () => {
|
||||
<p className="mt-2 text-gray-500">Once enabled, other users can signup.</p>
|
||||
</div>
|
||||
<div>
|
||||
<Button variant="outlined" color="neutral" onClick={handleSaveWorkspaceSetting}>
|
||||
<Button variant="outlined" color="neutral" disabled={!allowToSave} onClick={handleSaveWorkspaceSetting}>
|
||||
Save
|
||||
</Button>
|
||||
</div>
|
||||
|
Loading…
x
Reference in New Issue
Block a user