From eb0313f551058cd71aa5b133cdbaba5d2346cb8a Mon Sep 17 00:00:00 2001 From: MauriceNino Date: Mon, 27 Jun 2022 21:30:08 +0200 Subject: [PATCH] fix: transform dash. -> dashdot for icon find --- src/components/AppShelf/AddAppShelfItem.tsx | 25 +++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/src/components/AppShelf/AddAppShelfItem.tsx b/src/components/AppShelf/AddAppShelfItem.tsx index 80ee6c259..8cae277ab 100644 --- a/src/components/AppShelf/AddAppShelfItem.tsx +++ b/src/components/AppShelf/AddAppShelfItem.tsx @@ -1,7 +1,21 @@ import { - ActionIcon, Anchor, Button, Center, - Group, Image, LoadingOverlay, Modal, MultiSelect, - ScrollArea, Select, Switch, Tabs, Text, TextInput, Title, Tooltip + ActionIcon, + Anchor, + Button, + Center, + Group, + Image, + LoadingOverlay, + Modal, + MultiSelect, + ScrollArea, + Select, + Switch, + Tabs, + Text, + TextInput, + Title, + Tooltip, } from '@mantine/core'; import { useForm } from '@mantine/form'; import { useDebouncedValue } from '@mantine/hooks'; @@ -42,10 +56,13 @@ export function AddItemShelfButton(props: any) { } function MatchIcon(name: string, form: any) { + console.log(name, name.replace(/^dash\.$/, 'dashdot')); + fetch( `https://cdn.jsdelivr.net/gh/walkxhub/dashboard-icons/png/${name .replace(/\s+/g, '-') - .toLowerCase()}.png` + .toLowerCase() + .replace(/^dash\.$/, 'dashdot')}.png` ).then((res) => { if (res.ok) { form.setFieldValue('icon', res.url);