Skip to content

Commit

Permalink
feat: autofill favicon public page icon from scrape settings
Browse files Browse the repository at this point in the history
  • Loading branch information
drew-harris authored and skeptrunedev committed Jan 8, 2025
1 parent 7fa4d75 commit 2a37a7d
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions frontends/dashboard/src/hooks/usePublicPageSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,23 @@ export const { use: usePublicPage, provider: PublicPageProvider } =
}
});

// If the dataset has a url in crawl_options, automatically fill out a favicon.ico.
createEffect(() => {
if (
crawlSettingsQuery.data?.site_url &&
!extraParams.brandLogoImgSrcUrl
) {
const stripTrailingSlash = (str: string) => {
return str.endsWith("/") ? str.slice(0, -1) : str;
};

setExtraParams(
"brandLogoImgSrcUrl",
stripTrailingSlash(crawlSettingsQuery.data.site_url) + "/favicon.ico",
);
}
});

// manually set the array for rolemessages to simplify logic
// context blocks until it's set
createEffect(() => {
Expand Down

0 comments on commit 2a37a7d

Please sign in to comment.