Skip to content

Open-source and local-first Slack and Notion alternative that puts you in control of your data

Improve default avatar

Hakan Shehu200c00af18b9
diff --git a/desktop/src/lib/avatars.ts b/desktop/src/lib/avatars.ts
index 0f6bc958..a781644b 100644
--- a/desktop/src/lib/avatars.ts
+++ b/desktop/src/lib/avatars.ts
@@ -40,30 +40,30 @@ export const getAvatarUrl = (accountId: string, avatar: string): string => {
return `avatar://${accountId}/${avatar}`;
};
-export const getDefaultNodeIcon = (type: IdType): string => {
+export const getDefaultNodeAvatar = (type: IdType): string => {
if (type === IdType.Channel) {
- return 'discuss-line';
+ return '01h37jbxq11hpcnw1mdfgmm70cem';
}
if (type === IdType.Page) {
- return 'book-line';
+ return '01h37jbxqc5srhy96v34dxaa2aem';
}
if (type === IdType.Database) {
- return 'database-2-line';
+ return '01h37jbxqc5srhy96v34dxaa25em';
}
if (type === IdType.Record) {
- return 'article-line';
+ return '01h37jbxqc5srhy96v34dxaa2dem';
}
if (type === IdType.Folder) {
- return 'folder-open-line';
+ return '01h37jbxqc5srhy96v34dxaa36em';
}
if (type === IdType.Space) {
- return 'team-line';
+ return '01h37jbxq7628n8m2bwdandtbxem';
}
- return 'file-unknown-line';
+ return null;
};
diff --git a/desktop/src/renderer/components/avatars/avatar.tsx b/desktop/src/renderer/components/avatars/avatar.tsx
index 6dd18ba8..457c1406 100644
--- a/desktop/src/renderer/components/avatars/avatar.tsx
+++ b/desktop/src/renderer/components/avatars/avatar.tsx
@@ -4,10 +4,9 @@ import {
getAvatarSizeClasses,
getAvatarUrl,
getColorForId,
- getDefaultNodeIcon,
+ getDefaultNodeAvatar,
} from '@/lib/avatars';
import { getIdType, IdType } from '@/lib/id';
-import { Icon } from '@/renderer/components/ui/icon';
import { getEmojiUrl } from '@/lib/emojis';
import { getIconUrl } from '@/lib/icons';
import { useAccount } from '@/renderer/contexts/account';
@@ -37,6 +36,20 @@ export const Avatar = (props: AvatarProps) => {
};
const AvatarFallback = ({ id, name, size, className }: AvatarProps) => {
+ const idType = getIdType(id);
+ const defaultAvatar = getDefaultNodeAvatar(idType);
+ if (defaultAvatar) {
+ return (
+ <Avatar
+ id={id}
+ name={name}
+ avatar={defaultAvatar}
+ size={size}
+ className={className}
+ />
+ );
+ }
+
if (name) {
const color = getColorForId(id);
return (
@@ -53,11 +66,7 @@ const AvatarFallback = ({ id, name, size, className }: AvatarProps) => {
);
}
- const idType = getIdType(id);
- const icon = getDefaultNodeIcon(idType);
- return (
- <Icon name={icon} className={cn(getAvatarSizeClasses(size), className)} />
- );
+ return null;
};
const EmojiAvatar = ({ avatar, size, className }: AvatarProps) => {