Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix ability to set appearance of Focus status and remove unused refer… #968

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions src/components/markdown/plugins/htmlToText.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Plugin } from "unified";
import { visit } from "unist-util-visit";
export const remarkHtmlToText: Plugin = () => {
return (tree) => {
visit(tree, "html", (node: { type: string; value: string }) => {
node.type = "text";
});
};
};
import { Plugin } from "unified";
import { visit } from "unist-util-visit";

export const remarkHtmlToText: Plugin = () => {
return (tree) => {
visit(tree, "html", (node: { type: string; value: string }) => {
node.type = "text";
});
};
};
4 changes: 2 additions & 2 deletions src/components/settings/appearance/legacy/ThemeOverrides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ export default observer(() => {
"scrollbar-thumb",
"scrollbar-track",
"status-online",
"status-away",
"status-idle",
"status-focus",
"status-busy",
"status-streaming",
"status-invisible",
"success",
"warning",
Expand Down
11 changes: 5 additions & 6 deletions src/components/settings/roles/PermissionSelect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,12 @@ export function PermissionSelect({
}

return "Neutral";
}
if (Long.fromNumber(value).and(permission).eq(permission)) {
return "Allow";
}
}
if (Long.fromNumber(value).and(permission).eq(permission)) {
return "Allow";
}

return "Neutral";

return "Neutral";
}, [value]);

function onSwitch(state: State) {
Expand Down
9 changes: 3 additions & 6 deletions src/context/Theme.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,9 @@ export type Variables =
| "tertiary-foreground"
| "tooltip"
| "status-online"
| "status-away"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While revite is in maintenance mode, it seems pointless to break existing themes.

| "status-idle"
| "status-focus"
| "status-busy"
| "status-streaming"
| "status-invisible";

// While this isn't used, it'd be good to keep this up to date as a reference or for future use
Expand Down Expand Up @@ -283,10 +282,9 @@ export const PRESETS: Record<string, Theme> = {
"tertiary-background": "#4D4D4D",
"tertiary-foreground": "#3a3a3a",
"status-online": "#3ABF7E",
"status-away": "#F39F00",
"status-idle": "#F39F00",
"status-focus": "#4799F0",
"status-busy": "#F84848",
"status-streaming": "#977EFF",
"status-invisible": "#A5A5A5",
},
dark: {
Expand All @@ -311,10 +309,9 @@ export const PRESETS: Record<string, Theme> = {
"tertiary-background": "#4D4D4D",
"tertiary-foreground": "#848484",
"status-online": "#3ABF7E",
"status-away": "#F39F00",
"status-idle": "#F39F00",
"status-focus": "#4799F0",
"status-busy": "#F84848",
"status-streaming": "#977EFF",
"status-invisible": "#A5A5A5",
},
};
Expand Down
2 changes: 1 addition & 1 deletion src/controllers/client/jsx/error.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export function takeError(error: any): string {
case 429:
return "TooManyRequests";
case 401:
return "Unauthorized"
return "Unauthorized";
case 403:
return "Forbidden";
default:
Expand Down
6 changes: 4 additions & 2 deletions src/controllers/modals/components/CreateInvite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ import { ModalForm } from "@revoltchat/ui";

import { noopAsync } from "../../../lib/js";

import { IS_REVOLT } from "../../../version";
import { takeError } from "../../client/jsx/error";
import { modalController } from "../ModalController";
import { ModalProps } from "../types";
import { IS_REVOLT } from "../../../version";

/**
* Code block which displays invite
Expand Down Expand Up @@ -79,7 +79,9 @@ export default function CreateInvite({
children: <Text id="app.context_menu.copy_link" />,
onClick: () =>
modalController.writeText(
IS_REVOLT ? `https://rvlt.gg/${code}` : `${window.location.host}/invite/${code}`
IS_REVOLT
? `https://rvlt.gg/${code}`
: `${window.location.host}/invite/${code}`,
),
},
]}
Expand Down
32 changes: 17 additions & 15 deletions src/lib/ContextMenus.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,32 @@ import { ChevronRight, Trash } from "@styled-icons/boxicons-regular";
import { Cog, UserVoice } from "@styled-icons/boxicons-solid";
import { isFirefox } from "react-device-detect";
import { useHistory } from "react-router-dom";
import { Channel, Message, Server, User, API, Permission, UserPermission, Member } from "revolt.js";



import { ContextMenuWithData, MenuItem, openContextMenu } from "preact-context-menu";
import {
Channel,
Message,
Server,
User,
API,
Permission,
UserPermission,
Member,
} from "revolt.js";

import {
ContextMenuWithData,
MenuItem,
openContextMenu,
} from "preact-context-menu";
import { Text } from "preact-i18n";



import { Column, IconButton, LineDivider } from "@revoltchat/ui";



import { useApplicationState } from "../mobx/State";
import { QueuedMessage } from "../mobx/stores/MessageQueue";
import { NotificationState } from "../mobx/stores/NotificationOptions";



import CMNotifications from "./contextmenu/CMNotifications";



import Tooltip from "../components/common/Tooltip";
import UserStatus from "../components/common/user/UserStatus";
import { useSession } from "../controllers/client/ClientController";
Expand All @@ -33,7 +36,6 @@ import { modalController } from "../controllers/modals/ModalController";
import { internalEmit } from "./eventEmitter";
import { getRenderer } from "./renderer/Singleton";


interface ContextMenuData {
user?: string;
server?: string;
Expand Down Expand Up @@ -1293,4 +1295,4 @@ export default function ContextMenus() {
<CMNotifications />
</>
);
}
}
11 changes: 5 additions & 6 deletions src/mobx/stores/helpers/SAudio.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,11 +82,10 @@ export default class SAudio {
getAudio(path: string) {
if (this.cache.has(path)) {
return this.cache.get(path)!;
}
const el = new Audio(path);
this.cache.set(path, el);
return el;

}
const el = new Audio(path);
this.cache.set(path, el);
return el;
}

loadCache() {
Expand All @@ -100,7 +99,7 @@ export default class SAudio {
try {
audio.play();
} catch (err) {
console.error("Hit error while playing", `${sound }:`, err);
console.error("Hit error while playing", `${sound}:`, err);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/mobx/stores/helpers/STheme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export default class STheme {
for (const key of Object.keys(variables)) {
const value = variables[key];
if (typeof value === "string") {
variables[`${key }-contrast`] = getContrastingColour(value);
variables[`${key}-contrast`] = getContrastingColour(value);
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/pages/home/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ export default observer(() => {
state.settings.set("appearance:seasonal", !seasonalTheme);

const isDecember = !isTouchscreenDevice && new Date().getMonth() === 11;
const isOctober = !isTouchscreenDevice && new Date().getMonth() === 9
const isOctober = !isTouchscreenDevice && new Date().getMonth() === 9;
const snowflakes = useMemo(() => {
const flakes: string[] = [];

Expand Down
2 changes: 1 addition & 1 deletion src/styles/_context-menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@
}

&.idle {
background: var(--status-away);
background: var(--status-idle);
}

&.focus {
Expand Down
2 changes: 1 addition & 1 deletion src/sw.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ precacheAndRoute(
}

for (const key of locale_keys) {
if (fn.startsWith(`${key }.`)) {
if (fn.startsWith(`${key}.`)) {
return false;
}
}
Expand Down
Loading