feat: Custom accent color (#4897)

* types

* Working, but messy

* Add InputColor component

* types

* Show default theme values when not customized

* Support custom theme on team sign-in page

* Payload validation

* Custom theme on shared documents

* Improve theme validation

* Team -> Workspace in settings
This commit is contained in:
Tom Moor
2023-02-19 10:43:03 -05:00
committed by GitHub
parent 7c05b7326a
commit 70beb7524f
45 changed files with 684 additions and 390 deletions

View File

@@ -20,7 +20,11 @@ import {
AllowNull,
AfterUpdate,
} from "sequelize-typescript";
import { CollectionPermission, TeamPreference } from "@shared/types";
import {
CollectionPermission,
TeamPreference,
TeamPreferences,
} from "@shared/types";
import { getBaseDomain, RESERVED_SUBDOMAINS } from "@shared/utils/domains";
import env from "@server/env";
import DeleteAttachmentTask from "@server/queues/tasks/DeleteAttachmentTask";
@@ -39,8 +43,6 @@ import NotContainsUrl from "./validators/NotContainsUrl";
const readFile = util.promisify(fs.readFile);
export type TeamPreferences = Record<string, unknown>;
@Scopes(() => ({
withDomains: {
include: [{ model: TeamDomain }],
@@ -184,7 +186,10 @@ class Team extends ParanoidModel {
* @param value Sets the preference value
* @returns The current team preferences
*/
public setPreference = (preference: TeamPreference, value: boolean) => {
public setPreference = <T extends keyof TeamPreferences>(
preference: T,
value: TeamPreferences[T]
) => {
if (!this.preferences) {
this.preferences = {};
}