Skip to content

Commit

Permalink
Renamed "Night mode" to "Dark theme"
Browse files Browse the repository at this point in the history
Renamed "Night mode" to "Dark theme" throughout the app.
  • Loading branch information
aritroCoder authored Dec 14, 2022
1 parent b6218db commit 725a5ca
Show file tree
Hide file tree
Showing 9 changed files with 36 additions and 11 deletions.
4 changes: 2 additions & 2 deletions docs/changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -1900,7 +1900,7 @@ Bugfixes and other improvements for your Zulip experience.
### Highlights for users (since 26.1.124 / 26.2.125)

* Highlight colors for code blocks now match the webapp and
offer more contrast, especially in night mode.
offer more contrast, especially in Dark theme.

Plus, like every release, many other improvements for your Zulip
experience.
Expand All @@ -1919,7 +1919,7 @@ experience.
### Highlights for users (since 26.1.124 / 26.2.125)

* Highlight colors for code blocks now match the webapp and
offer more contrast, especially in night mode.
offer more contrast, especially in Dark theme.

Plus, like every release, many other improvements for your Zulip
experience.
Expand Down
4 changes: 2 additions & 2 deletions src/emoji/codePointMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@ export const override: {| [code: string]: string |} = {

// Fix the "letter" emoji. The codes in Zulip's emoji database would give
// these a text-style rather than emoji-style presentation; that's subtler
// than we want, plus when not in night mode it's actually invisible.
// than we want, plus when not in Dark theme it's actually invisible.
'1f170': '1f170-fe0f', // :a:
'1f171': '1f171-fe0f', // :b:
'1f17e': '1f17e-fe0f', // :o:
'1f17f': '1f17f-fe0f', // :p:
// (Zulip only actually offers a handful of these letter emoji.)

// :check_mark: -> :check: because the former is invisible on a light
// background, i.e. when not in night mode.
// background, i.e. when not in Dark theme.
'2714': '2705',
};

Expand Down
2 changes: 1 addition & 1 deletion src/reduxTypes.js
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ export type ThemeName = 'light' | 'dark';
* To determine the actual theme to show the user, use a ThemeName;
* see there for details.
*/
export type ThemeSetting = 'default' | 'night';
export type ThemeSetting = 'default' | 'dark';

/** What browser the user has set to use for opening links in messages.
*
Expand Down
4 changes: 2 additions & 2 deletions src/settings/SettingsScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,12 @@ export default function SettingsScreen(props: Props): Node {
const { navigation } = props;

const handleThemeChange = useCallback(() => {
dispatch(setGlobalSettings({ theme: theme === 'default' ? 'night' : 'default' }));
dispatch(setGlobalSettings({ theme: theme === 'default' ? 'dark' : 'default' }));
}, [theme, dispatch]);

return (
<Screen title="Settings">
<SwitchRow label="Night mode" value={theme === 'night'} onValueChange={handleThemeChange} />
<SwitchRow label="Dark theme" value={theme === 'dark'} onValueChange={handleThemeChange} />
<SwitchRow
label="Open links with in-app browser"
value={shouldUseInAppBrowser(browser)}
Expand Down
4 changes: 2 additions & 2 deletions src/settings/__tests__/settingsReducer-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,12 @@ describe('settingsReducer', () => {
test('changes value of a key', () => {
const action = deepFreeze({
type: SET_GLOBAL_SETTINGS,
update: { theme: 'night' },
update: { theme: 'dark' },
});

const expectedState = {
...baseState,
theme: 'night',
theme: 'dark',
};

const actualState = settingsReducer(baseState, action);
Expand Down
16 changes: 15 additions & 1 deletion src/storage/__tests__/migrations-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('migrations', () => {
// What `base` becomes after all migrations.
const endBase = {
...base52,
migrations: { version: 56 },
migrations: { version: 57 },
};

for (const [desc, before, after] of [
Expand Down Expand Up @@ -278,6 +278,20 @@ describe('migrations', () => {
},
{ ...endBase, settings: { ...endBase.settings, markMessagesReadOnScroll: 'never' } },
],
[
"check 57 with 'night'",
{ ...base52, migrations: { version: 56 }, settings: { ...base52.settings, theme: 'night' } },
{ ...endBase, settings: { ...endBase.settings, theme: 'dark' } },
],
[
"check 57 with 'default'",
{
...base52,
migrations: { version: 56 },
settings: { ...base52.settings, theme: 'default' },
},
{ ...endBase, settings: { ...endBase.settings, theme: 'default' } },
],
]) {
/* eslint-disable no-loop-func */
test(desc, async () => {
Expand Down
6 changes: 6 additions & 0 deletions src/storage/migrations.js
Original file line number Diff line number Diff line change
Expand Up @@ -472,6 +472,12 @@ const migrationsInner: {| [string]: (LessPartialState) => LessPartialState |} =
// Add presenceEnabled to state.realm.
'56': dropCache,

// Rename 'night' to 'dark' in state.settings.theme
'57': state => ({
...state,
settings: { ...state.settings, theme: state.settings.theme === 'night' ? 'dark' : 'default' },
}),

// TIP: When adding a migration, consider just using `dropCache`.
// (See its jsdoc for guidance on when that's the right answer.)
};
Expand Down
2 changes: 1 addition & 1 deletion static/translations/messages_en.json
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@
"Learn more": "Learn more",
"Full profile": "Full profile",
"Settings": "Settings",
"Night mode": "Night mode",
"Dark theme": "Dark theme",
"Open links with in-app browser": "Open links with in-app browser",
"Language": "Language",
"Arabic": "Arabic",
Expand Down
5 changes: 5 additions & 0 deletions static/translations/messages_tl.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,13 @@
"{realm} is running Zulip Server {serverVersion}, which is unsupported. Please contact your administrator about upgrading.": "{realm} is running Zulip Server {serverVersion}, which is unsupported. Please contact your administrator about upgrading.",
"Learn more": "Learn more",
"Full profile": "Full profile",
<<<<<<< HEAD
"Settings": "Settings",
"Night mode": "Night mode",
=======
"Settings": "Mga Itinakda",
"Night mode": "Night mode",
>>>>>>> c8af6d69ecbed660643facc1e84b416e3dbff879
"Open links with in-app browser": "Open links with in-app browser",
"Language": "Wika",
"Arabic": "Arabic",
Expand Down

0 comments on commit 725a5ca

Please sign in to comment.