Skip to content

πŸ“š The open-source, offline-first Notion, Obsidian & Confluence alternative. Advanced Markdown, multi-tenant teams, OIDC/SSO, and local S3 backups. Deploy in one command.

Fix getAppColor priority of 'Unset' when default

Smaug67396a4917faf295
diff --git a/frontend/app/composables/utils.ts b/frontend/app/composables/utils.ts
index d327e23c..e99178b1 100644
--- a/frontend/app/composables/utils.ts
+++ b/frontend/app/composables/utils.ts
@@ -14,8 +14,8 @@ export function useAvatar(user?: User): string {
export const appColors = ['blue', 'red', 'green', 'yellow', 'purple', 'pink', 'teal', 'grey'];
export function getAppColor(index: number = 0, defaultPrimary?: boolean): string {
+ if ((defaultPrimary && index < 0) || index == -2) return 'primary';
if (index == -1) return '';
- if ((defaultPrimary && !index) || index == -2) return 'primary';
return appColors[index % appColors.length] || 'primary';
}
@@ -27,19 +27,6 @@ export function formatDate(timestamp: number | undefined): string {
const date = new Date(timestamp || 0);
return `${date.getDate()} ${date.toLocaleString('default', { month: 'short' })} ${date.getFullYear()}`;
}
-export function debounce(fn: Function, wait: number) {
- let timer: NodeJS.Timeout;
- return function (...args: any[]) {
- if (timer) {
- clearTimeout(timer); // clear any pre-existing timer
- }
- // @ts-ignore
- const context = this; // get the current context
- timer = setTimeout(() => {
- fn.apply(context, args); // call the function if time expires
- }, wait);
- };
-}
export function setAppColor(color: string | number) {
if (typeof color === 'number') {