Skip to content

Commit

Permalink
Update Default Settings (#9)
Browse files Browse the repository at this point in the history
  • Loading branch information
sharunkumar authored Nov 12, 2024
2 parents f2e29d2 + 0693824 commit 6c6094c
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 9 deletions.
1 change: 1 addition & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"editor.codeActionsOnSave": {
"source.fixAll.eslint": "explicit"
},
"files.eol": "\n",
"eslint.codeActionsOnSave.rules": [
"perfectionist/*"
],
Expand Down
2 changes: 2 additions & 0 deletions src/features/post/inFeed/large/LargePost.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import ModqueueItemActions from "#/features/moderation/ModqueueItemActions";
import Crosspost from "#/features/post/crosspost/Crosspost";
import MoreActions from "#/features/post/shared/MoreActions";
import MoreModActions from "#/features/post/shared/MoreModAction";
import { SaveButton } from "#/features/post/shared/SaveButton";
import { VoteButton } from "#/features/post/shared/VoteButton";
import useCrosspostUrl from "#/features/post/shared/useCrosspostUrl";
import { maxWidthCss } from "#/features/shared/AppContent";
Expand Down Expand Up @@ -195,6 +196,7 @@ export default function LargePost({ post }: PostProps) {
<MoreModActions post={post} />
<VoteButton type="up" post={post} />
<VoteButton type="down" post={post} />
<SaveButton post={post} />
</>
)}
</RightDetails>
Expand Down
12 changes: 12 additions & 0 deletions src/features/settings/custom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import { SettingsState } from "./settingsSlice";

export function custom(s: SettingsState): SettingsState {
s.appearance.font.fontSizeMultiplier = 0.8;
s.appearance.general.profileLabel = "handle";
s.appearance.theme = "tangerine";
s.appearance.voting.voteDisplayMode = "separate";
s.general.comments.sort = "Top";
s.general.enableHapticFeedback = false;
s.general.posts.upvoteOnSave = true;
return s;
}
19 changes: 10 additions & 9 deletions src/features/settings/settingsSlice.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ import {
} from "#/services/db";
import { AppDispatch, RootState } from "#/store";

import { custom } from "./custom";
import {
LOCALSTORAGE_KEYS,
getLocalStorageInitialState,
Expand Down Expand Up @@ -165,7 +166,7 @@ export interface SettingsState {
};
}

const baseState: SettingsState = {
const baseState: SettingsState = custom({
ready: false,

databaseError: undefined,
Expand All @@ -186,15 +187,15 @@ const baseState: SettingsState = {
},
deviceMode: "ios",
font: {
fontSizeMultiplier: 0.8,
fontSizeMultiplier: 1,
useSystemFontSize: false,
},
general: {
profileLabel: OProfileLabelType.Handle,
profileLabel: OProfileLabelType.Instance,
userInstanceUrlDisplay: OInstanceUrlDisplayMode.Never,
},
large: {
showVotingButtons: false,
showVotingButtons: true,
},
posts: {
alwaysShowAuthor: false,
Expand All @@ -207,10 +208,10 @@ const baseState: SettingsState = {
subscribedIcon: OShowSubscribedIcon.Never,
type: OPostAppearanceType.Large,
},
theme: "tangerine",
theme: "default",
votesTheme: "lemmy",
voting: {
voteDisplayMode: OVoteDisplayMode.Separate,
voteDisplayMode: OVoteDisplayMode.Total,
},
},
blocks: {
Expand All @@ -226,12 +227,12 @@ const baseState: SettingsState = {
showCollapsed: false,
showCommentImages: true,
showJumpButton: false,
sort: OCommentDefaultSort.Top,
sort: OCommentDefaultSort.Hot,
tapToCollapse: OTapToCollapseType.Both,
touchFriendlyLinks: true,
},
defaultFeed: undefined,
enableHapticFeedback: false,
enableHapticFeedback: true,
linkHandler: OLinkHandlerType.InApp,
noSubscribedInFeed: false,
posts: {
Expand Down Expand Up @@ -259,7 +260,7 @@ const baseState: SettingsState = {
saveSource: true,
trackVotes: false,
},
};
});

/**
* We continue using localstorage for specific items because indexeddb is slow
Expand Down

0 comments on commit 6c6094c

Please sign in to comment.