mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-09 00:33:38 -05:00
feat: add focus mode
This commit is contained in:
parent
47bfaad508
commit
e6ad6a552e
10 changed files with 40 additions and 12 deletions
2
external/components
vendored
2
external/components
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 557094115d17a363eb6fb8f27c6e697e049ce623
|
||||
Subproject commit ab0fc1af739f877c8f416dcd7e47d25aacbb7eea
|
2
external/lang
vendored
2
external/lang
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 14d51d68a579ee3796837cd16deda4281f83c923
|
||||
Subproject commit 843cece2854185651e17765bcb78109d22eba769
|
2
external/revolt.js
vendored
2
external/revolt.js
vendored
|
@ -1 +1 @@
|
|||
Subproject commit 044b1b91ee583bfb89fff140ecda29a32f6535aa
|
||||
Subproject commit ab064f41a4154acee7c1751ea5b59d9ee4345a0b
|
|
@ -25,6 +25,8 @@ export function useStatusColour(user?: User) {
|
|||
return user?.online && user?.status?.presence !== "Invisible"
|
||||
? user?.status?.presence === "Idle"
|
||||
? theme.getVariable("status-away")
|
||||
: user?.status?.presence === "Focus"
|
||||
? theme.getVariable("status-focus")
|
||||
: user?.status?.presence === "Busy"
|
||||
? theme.getVariable("status-busy")
|
||||
: theme.getVariable("status-online")
|
||||
|
|
|
@ -32,6 +32,10 @@ export default observer(({ user, tooltip }: Props) => {
|
|||
return <Text id="app.status.idle" />;
|
||||
}
|
||||
|
||||
if (user.status?.presence === "Focus") {
|
||||
return <Text id="app.status.focus" />;
|
||||
}
|
||||
|
||||
if (user.status?.presence === "Invisible") {
|
||||
return <Text id="app.status.offline" />;
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ export type Variables =
|
|||
| "tooltip"
|
||||
| "status-online"
|
||||
| "status-away"
|
||||
| "status-focus"
|
||||
| "status-busy"
|
||||
| "status-streaming"
|
||||
| "status-invisible";
|
||||
|
@ -283,6 +284,7 @@ export const PRESETS: Record<string, Theme> = {
|
|||
"tertiary-foreground": "#3a3a3a",
|
||||
"status-online": "#3ABF7E",
|
||||
"status-away": "#F39F00",
|
||||
"status-focus": "#4799F0",
|
||||
"status-busy": "#F84848",
|
||||
"status-streaming": "#977EFF",
|
||||
"status-invisible": "#A5A5A5",
|
||||
|
@ -310,6 +312,7 @@ export const PRESETS: Record<string, Theme> = {
|
|||
"tertiary-foreground": "#848484",
|
||||
"status-online": "#3ABF7E",
|
||||
"status-away": "#F39F00",
|
||||
"status-focus": "#4799F0",
|
||||
"status-busy": "#F84848",
|
||||
"status-streaming": "#977EFF",
|
||||
"status-invisible": "#A5A5A5",
|
||||
|
@ -336,9 +339,8 @@ export const generateVariables = (theme: Theme) => {
|
|||
if (colour) {
|
||||
const [r, g, b] = colour;
|
||||
return `--${key}: ${theme[key]}; --${key}-rgb: ${r}, ${g}, ${b};`;
|
||||
}
|
||||
return `--${key}: ${theme[key]};`;
|
||||
|
||||
}
|
||||
return `--${key}: ${theme[key]};`;
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -1110,6 +1110,15 @@ export default function ContextMenus() {
|
|||
<div className="indicator idle" />
|
||||
<Text id={`app.status.idle`} />
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
data={{
|
||||
action: "set_presence",
|
||||
presence: "Focus",
|
||||
}}
|
||||
disabled={!isOnline}>
|
||||
<div className="indicator focus" />
|
||||
<Text id={`app.status.focus`} />
|
||||
</MenuItem>
|
||||
<MenuItem
|
||||
data={{
|
||||
action: "set_presence",
|
||||
|
|
|
@ -157,6 +157,8 @@ export default class NotificationOptions
|
|||
return false;
|
||||
}
|
||||
|
||||
// Check channel notification settings
|
||||
const mentioned = message.mention_ids?.includes(user._id);
|
||||
switch (this.computeForChannel(message.channel!)) {
|
||||
case "muted":
|
||||
case "none":
|
||||
|
@ -164,7 +166,12 @@ export default class NotificationOptions
|
|||
return false;
|
||||
case "mention":
|
||||
// Ignore if it doesn't mention us.
|
||||
if (!message.mention_ids?.includes(user._id)) return false;
|
||||
if (!mentioned) return false;
|
||||
}
|
||||
|
||||
// Check if we are in focus mode
|
||||
if (user.status?.presence === "Focus" && !mentioned) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
|
|
|
@ -92,6 +92,10 @@
|
|||
background: var(--status-away);
|
||||
}
|
||||
|
||||
&.focus {
|
||||
background: var(--status-focus);
|
||||
}
|
||||
|
||||
&.busy {
|
||||
background: var(--status-busy);
|
||||
}
|
||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -8012,14 +8012,14 @@ __metadata:
|
|||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
"revolt-api@npm:0.5.5-3":
|
||||
version: 0.5.5-3
|
||||
resolution: "revolt-api@npm:0.5.5-3"
|
||||
"revolt-api@npm:0.5.5-4":
|
||||
version: 0.5.5-4
|
||||
resolution: "revolt-api@npm:0.5.5-4"
|
||||
dependencies:
|
||||
"@insertish/oapi": 0.1.18
|
||||
axios: ^0.26.1
|
||||
lodash.defaultsdeep: ^4.6.1
|
||||
checksum: adf13c87ad22acced931fbac45d49d858346ad03c0aea5045af2e38ee345b85a094b6b2abf76aed93dc6694daae5235e3fd9ed2f213f4700b5ce07688b8a4503
|
||||
checksum: dfb374d58f1b8b5a6de2e7fa05e386b3df3ffb85a450a6894f23c6b9760af8bff0d198d8352063c33084f0dbc6ff84a234300efb0c62c7b27f709887402787f1
|
||||
languageName: node
|
||||
linkType: hard
|
||||
|
||||
|
@ -8036,7 +8036,7 @@ __metadata:
|
|||
lodash.isequal: ^4.5.0
|
||||
long: ^5.2.0
|
||||
mobx: ^6.3.2
|
||||
revolt-api: 0.5.5-3
|
||||
revolt-api: 0.5.5-4
|
||||
ulid: ^2.3.0
|
||||
ws: ^8.2.2
|
||||
languageName: node
|
||||
|
|
Loading…
Reference in a new issue