Skip to content

Commit

Permalink
chore: update user settings
Browse files Browse the repository at this point in the history
  • Loading branch information
boojack committed Sep 12, 2023
1 parent 8992d48 commit 908f957
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 13 deletions.
5 changes: 3 additions & 2 deletions api/v2/user_setting_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,9 @@ func getUserSetting(ctx context.Context, s *store.Store, userID int32) (*apiv2pb
}

userSetting := &apiv2pb.UserSetting{
Id: userID,
Locale: apiv2pb.UserSetting_LOCALE_EN,
Id: userID,
Locale: apiv2pb.UserSetting_LOCALE_EN,
ColorTheme: apiv2pb.UserSetting_COLOR_THEME_LIGHT,
}
for _, setting := range userSettings {
if setting.Key == storepb.UserSettingKey_USER_SETTING_LOCALE {
Expand Down
10 changes: 5 additions & 5 deletions frontend/web/src/components/setting/PreferenceSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const PreferenceSection: React.FC = () => {
const { t } = useTranslation();
const userStore = useUserStore();
const userSetting = userStore.getCurrentUserSetting();
const language = userSetting.locale || UserSetting_Locale.EN;
const language = userSetting.locale;
const colorTheme = userSetting.colorTheme;

const languageOptions = [
Expand All @@ -23,10 +23,6 @@ const PreferenceSection: React.FC = () => {
];

const colorThemeOptions = [
{
value: "COLOR_THEME_UNSPECIFIED",
label: "Auto",
},
{
value: "COLOR_THEME_LIGHT",
label: "Light",
Expand All @@ -52,6 +48,10 @@ const PreferenceSection: React.FC = () => {
};

const handleSelectColorTheme = async (colorTheme: UserSetting_ColorTheme) => {
if (!colorTheme) {
return;
}

await userStore.updateUserSetting(
{
...userSetting,
Expand Down
4 changes: 2 additions & 2 deletions frontend/web/src/pages/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ const Home: React.FC = () => {
loading
</div>
) : orderedShortcutList.length === 0 ? (
<div className="py-16 w-full flex flex-col justify-center items-center">
<Icon.PackageOpen className="w-16 h-auto text-gray-400" />
<div className="py-16 w-full flex flex-col justify-center items-center text-gray-400">
<Icon.PackageOpen className="w-16 h-auto" strokeWidth="1" />
<p className="mt-4">No shortcuts found.</p>
</div>
) : (
Expand Down
4 changes: 0 additions & 4 deletions frontend/web/src/pages/Setting.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ const Setting: React.FC = () => {
{isAdmin && (
<>
<Divider />
<div>
<h2 className="text-2xl font-bold">Workspace setting</h2>
<p className="text-gray-500 text-sm">Manage your workspace.</p>
</div>
<MemberSection />
<WorkspaceSection />
</>
Expand Down

0 comments on commit 908f957

Please sign in to comment.