mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-25 16:40:58 -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"
|
return user?.online && user?.status?.presence !== "Invisible"
|
||||||
? user?.status?.presence === "Idle"
|
? user?.status?.presence === "Idle"
|
||||||
? theme.getVariable("status-away")
|
? theme.getVariable("status-away")
|
||||||
|
: user?.status?.presence === "Focus"
|
||||||
|
? theme.getVariable("status-focus")
|
||||||
: user?.status?.presence === "Busy"
|
: user?.status?.presence === "Busy"
|
||||||
? theme.getVariable("status-busy")
|
? theme.getVariable("status-busy")
|
||||||
: theme.getVariable("status-online")
|
: theme.getVariable("status-online")
|
||||||
|
|
|
@ -32,6 +32,10 @@ export default observer(({ user, tooltip }: Props) => {
|
||||||
return <Text id="app.status.idle" />;
|
return <Text id="app.status.idle" />;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (user.status?.presence === "Focus") {
|
||||||
|
return <Text id="app.status.focus" />;
|
||||||
|
}
|
||||||
|
|
||||||
if (user.status?.presence === "Invisible") {
|
if (user.status?.presence === "Invisible") {
|
||||||
return <Text id="app.status.offline" />;
|
return <Text id="app.status.offline" />;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,6 +31,7 @@ export type Variables =
|
||||||
| "tooltip"
|
| "tooltip"
|
||||||
| "status-online"
|
| "status-online"
|
||||||
| "status-away"
|
| "status-away"
|
||||||
|
| "status-focus"
|
||||||
| "status-busy"
|
| "status-busy"
|
||||||
| "status-streaming"
|
| "status-streaming"
|
||||||
| "status-invisible";
|
| "status-invisible";
|
||||||
|
@ -283,6 +284,7 @@ export const PRESETS: Record<string, Theme> = {
|
||||||
"tertiary-foreground": "#3a3a3a",
|
"tertiary-foreground": "#3a3a3a",
|
||||||
"status-online": "#3ABF7E",
|
"status-online": "#3ABF7E",
|
||||||
"status-away": "#F39F00",
|
"status-away": "#F39F00",
|
||||||
|
"status-focus": "#4799F0",
|
||||||
"status-busy": "#F84848",
|
"status-busy": "#F84848",
|
||||||
"status-streaming": "#977EFF",
|
"status-streaming": "#977EFF",
|
||||||
"status-invisible": "#A5A5A5",
|
"status-invisible": "#A5A5A5",
|
||||||
|
@ -310,6 +312,7 @@ export const PRESETS: Record<string, Theme> = {
|
||||||
"tertiary-foreground": "#848484",
|
"tertiary-foreground": "#848484",
|
||||||
"status-online": "#3ABF7E",
|
"status-online": "#3ABF7E",
|
||||||
"status-away": "#F39F00",
|
"status-away": "#F39F00",
|
||||||
|
"status-focus": "#4799F0",
|
||||||
"status-busy": "#F84848",
|
"status-busy": "#F84848",
|
||||||
"status-streaming": "#977EFF",
|
"status-streaming": "#977EFF",
|
||||||
"status-invisible": "#A5A5A5",
|
"status-invisible": "#A5A5A5",
|
||||||
|
@ -338,7 +341,6 @@ export const generateVariables = (theme: Theme) => {
|
||||||
return `--${key}: ${theme[key]}; --${key}-rgb: ${r}, ${g}, ${b};`;
|
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" />
|
<div className="indicator idle" />
|
||||||
<Text id={`app.status.idle`} />
|
<Text id={`app.status.idle`} />
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
|
<MenuItem
|
||||||
|
data={{
|
||||||
|
action: "set_presence",
|
||||||
|
presence: "Focus",
|
||||||
|
}}
|
||||||
|
disabled={!isOnline}>
|
||||||
|
<div className="indicator focus" />
|
||||||
|
<Text id={`app.status.focus`} />
|
||||||
|
</MenuItem>
|
||||||
<MenuItem
|
<MenuItem
|
||||||
data={{
|
data={{
|
||||||
action: "set_presence",
|
action: "set_presence",
|
||||||
|
|
|
@ -157,6 +157,8 @@ export default class NotificationOptions
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check channel notification settings
|
||||||
|
const mentioned = message.mention_ids?.includes(user._id);
|
||||||
switch (this.computeForChannel(message.channel!)) {
|
switch (this.computeForChannel(message.channel!)) {
|
||||||
case "muted":
|
case "muted":
|
||||||
case "none":
|
case "none":
|
||||||
|
@ -164,7 +166,12 @@ export default class NotificationOptions
|
||||||
return false;
|
return false;
|
||||||
case "mention":
|
case "mention":
|
||||||
// Ignore if it doesn't mention us.
|
// 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;
|
return true;
|
||||||
|
|
|
@ -92,6 +92,10 @@
|
||||||
background: var(--status-away);
|
background: var(--status-away);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.focus {
|
||||||
|
background: var(--status-focus);
|
||||||
|
}
|
||||||
|
|
||||||
&.busy {
|
&.busy {
|
||||||
background: var(--status-busy);
|
background: var(--status-busy);
|
||||||
}
|
}
|
||||||
|
|
10
yarn.lock
10
yarn.lock
|
@ -8012,14 +8012,14 @@ __metadata:
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
"revolt-api@npm:0.5.5-3":
|
"revolt-api@npm:0.5.5-4":
|
||||||
version: 0.5.5-3
|
version: 0.5.5-4
|
||||||
resolution: "revolt-api@npm:0.5.5-3"
|
resolution: "revolt-api@npm:0.5.5-4"
|
||||||
dependencies:
|
dependencies:
|
||||||
"@insertish/oapi": 0.1.18
|
"@insertish/oapi": 0.1.18
|
||||||
axios: ^0.26.1
|
axios: ^0.26.1
|
||||||
lodash.defaultsdeep: ^4.6.1
|
lodash.defaultsdeep: ^4.6.1
|
||||||
checksum: adf13c87ad22acced931fbac45d49d858346ad03c0aea5045af2e38ee345b85a094b6b2abf76aed93dc6694daae5235e3fd9ed2f213f4700b5ce07688b8a4503
|
checksum: dfb374d58f1b8b5a6de2e7fa05e386b3df3ffb85a450a6894f23c6b9760af8bff0d198d8352063c33084f0dbc6ff84a234300efb0c62c7b27f709887402787f1
|
||||||
languageName: node
|
languageName: node
|
||||||
linkType: hard
|
linkType: hard
|
||||||
|
|
||||||
|
@ -8036,7 +8036,7 @@ __metadata:
|
||||||
lodash.isequal: ^4.5.0
|
lodash.isequal: ^4.5.0
|
||||||
long: ^5.2.0
|
long: ^5.2.0
|
||||||
mobx: ^6.3.2
|
mobx: ^6.3.2
|
||||||
revolt-api: 0.5.5-3
|
revolt-api: 0.5.5-4
|
||||||
ulid: ^2.3.0
|
ulid: ^2.3.0
|
||||||
ws: ^8.2.2
|
ws: ^8.2.2
|
||||||
languageName: node
|
languageName: node
|
||||||
|
|
Loading…
Reference in a new issue