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:
@@ -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 = {};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user