Skip to content

Commit

Permalink
add options to use system emoji
Browse files Browse the repository at this point in the history
  • Loading branch information
ajbura committed Oct 4, 2023
1 parent 2639f20 commit 5f0b936
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"editor.formatOnSave": false,
"editor.formatOnSave": true,
"editor.defaultFormatter": "esbenp.prettier-vscode",
"typescript.tsdk": "node_modules/typescript/lib"
}
11 changes: 11 additions & 0 deletions src/app/organisms/settings/Settings.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ function AppearanceSection() {

const [messageLayout, setMessageLayout] = useSetting(settingsAtom, 'messageLayout');
const [messageSpacing, setMessageSpacing] = useSetting(settingsAtom, 'messageSpacing');
const [useSystemEmoji, setUseSystemEmoji] = useSetting(settingsAtom, 'useSystemEmoji');
const [hideMembershipEvents, setHideMembershipEvents] = useSetting(settingsAtom, 'hideMembershipEvents');
const [hideNickAvatarEvents, setHideNickAvatarEvents] = useSetting(settingsAtom, 'hideNickAvatarEvents');
const [mediaAutoLoad, setMediaAutoLoad] = useSetting(settingsAtom, 'mediaAutoLoad');
Expand Down Expand Up @@ -90,6 +91,16 @@ function AppearanceSection() {
/>
)}
/>
<SettingTile
title="Use System Emoji"
options={(
<Toggle
isActive={useSystemEmoji}
onToggle={() => setUseSystemEmoji(!useSystemEmoji)}
/>
)}
content={<Text variant="b3">Use system emoji instead of Twitter emojis.</Text>}
/>
</div>
<div className="settings-appearance__card">
<MenuHeader>Room messages</MenuHeader>
Expand Down
2 changes: 2 additions & 0 deletions src/app/state/settings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export interface Settings {
isMarkdown: boolean;
editorToolbar: boolean;
isPeopleDrawer: boolean;
useSystemEmoji: boolean;

messageLayout: MessageLayout;
messageSpacing: MessageSpacing;
Expand All @@ -27,6 +28,7 @@ const defaultSettings: Settings = {
isMarkdown: true,
editorToolbar: false,
isPeopleDrawer: true,
useSystemEmoji: false,

messageLayout: 0,
messageSpacing: '400',
Expand Down
15 changes: 15 additions & 0 deletions src/app/templates/client/Client.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,20 @@ import cons from '../../../client/state/cons';
import VerticalMenuIC from '../../../../public/res/ic/outlined/vertical-menu.svg';
import { MatrixClientProvider } from '../../hooks/useMatrixClient';
import { ClientContent } from './ClientContent';
import { useSetting } from '../../state/hooks/settings';
import { settingsAtom } from '../../state/settings';

function SystemEmojiFeature() {
const [systemEmoji] = useSetting(settingsAtom, 'useSystemEmoji');

if (systemEmoji) {
document.documentElement.style.setProperty('--font-emoji', 'Twemoji_DISABLED');
} else {
document.documentElement.style.setProperty('--font-emoji', 'Twemoji');
}

return null;
}

function Client() {
const [isLoading, changeLoading] = useState(true);
Expand Down Expand Up @@ -115,6 +129,7 @@ function Client() {
<Windows />
<Dialogs />
<ReusableContextMenu />
<SystemEmojiFeature />
</div>
</MatrixClientProvider>
);
Expand Down

0 comments on commit 5f0b936

Please sign in to comment.