From e9ccefd938ac80e454c85392d851dfe514451892 Mon Sep 17 00:00:00 2001 From: Sonny Date: Wed, 29 May 2024 18:10:17 +0200 Subject: [PATCH] fix: responsive --- app/controllers/favicons_controller.ts | 10 +- inertia/app/app.tsx | 9 +- .../collection/collection_container.tsx | 19 ++- .../header/collection_description.tsx | 8 +- .../collection/header/collection_header.tsx | 23 ++- .../collection/list/collection_list.tsx | 2 + .../components/dashboard/link/link_item.tsx | 2 +- .../dashboard/side_nav/nav_item.tsx | 2 +- .../dashboard/side_nav/side_navigation.tsx | 8 +- inertia/components/layouts/content_layout.tsx | 1 + .../components/layouts/dashboard_layout.tsx | 2 + inertia/components/navbar/navbar.tsx | 7 +- inertia/components/settings/modal.tsx | 2 +- inertia/pages/dashboard.tsx | 132 +++++++++++++++--- inertia/pages/login.tsx | 7 +- resources/views/inertia_layout.edge | 1 + 16 files changed, 183 insertions(+), 52 deletions(-) diff --git a/app/controllers/favicons_controller.ts b/app/controllers/favicons_controller.ts index af40025..95c990d 100644 --- a/app/controllers/favicons_controller.ts +++ b/app/controllers/favicons_controller.ts @@ -54,13 +54,21 @@ export default class FaviconsController { throw new FaviconNotFoundException(`No favicon path found in ${url}`); } + if (faviconPath.startsWith('http')) { + try { + return await this.fetchFavicon(faviconPath); + } catch { + logger.debug(`Unable to retrieve favicon from ${faviconPath}`); + } + } + return this.fetchFaviconFromPath(url, faviconPath); } private async fetchFavicon(url: string): Promise { const response = await this.fetchWithUserAgent(url); if (!response.ok) { - throw new FaviconNotFoundException(`Request to ${url} failed`); + throw new FaviconNotFoundException(`Request to favicon ${url} failed`); } const blob = await response.blob(); diff --git a/inertia/app/app.tsx b/inertia/app/app.tsx index 0f92cf2..0b79a22 100644 --- a/inertia/app/app.tsx +++ b/inertia/app/app.tsx @@ -1,12 +1,11 @@ import { resolvePageComponent } from '@adonisjs/inertia/helpers'; import { createInertiaApp } from '@inertiajs/react'; -import { hydrateRoot } from 'react-dom/client'; -import 'react-toggle/style.css'; -import { primaryColor } from '~/styles/theme'; -import '../i18n/index'; - import 'dayjs/locale/en'; import 'dayjs/locale/fr'; +import { hydrateRoot } from 'react-dom/client'; +import 'react-toggle/style.css'; +import { primaryColor } from '~/styles/common_colors'; +import '../i18n/index'; const appName = import.meta.env.VITE_APP_NAME || 'MyLinks'; diff --git a/inertia/components/dashboard/collection/collection_container.tsx b/inertia/components/dashboard/collection/collection_container.tsx index 48e7e7d..b2a80ff 100644 --- a/inertia/components/dashboard/collection/collection_container.tsx +++ b/inertia/components/dashboard/collection/collection_container.tsx @@ -1,10 +1,17 @@ import styled from '@emotion/styled'; +import { ReactNode } from 'react'; import CollectionHeader from '~/components/dashboard/collection/header/collection_header'; import LinkList from '~/components/dashboard/link/link_list'; import { NoCollection } from '~/components/dashboard/link/no_item'; import Footer from '~/components/footer/footer'; import useActiveCollection from '~/hooks/use_active_collection'; +export interface CollectionHeaderProps { + openNavigationItem: ReactNode; + openCollectionItem: ReactNode; + showButtons: boolean; +} + const CollectionContainerStyle = styled.div({ height: '100%', minWidth: 0, @@ -14,15 +21,7 @@ const CollectionContainerStyle = styled.div({ flexDirection: 'column', }); -interface CollectionContainerProps { - isMobile: boolean; - openSideMenu: () => void; -} - -export default function CollectionContainer({ - isMobile: _, - openSideMenu: __, -}: Readonly) { +export default function CollectionContainer(props: CollectionHeaderProps) { const { activeCollection } = useActiveCollection(); if (activeCollection === null) { @@ -31,7 +30,7 @@ export default function CollectionContainer({ return ( - +