Explorar o código

chore(client): remove getUrl helper method

Nicolas Meienberger hai 1 ano
pai
achega
8b5492bc34

+ 1 - 2
src/client/components/AppLogo/AppLogo.tsx

@@ -1,10 +1,9 @@
 import clsx from 'clsx';
 import React from 'react';
-import { getUrl } from '../../core/helpers/url-helpers';
 import styles from './AppLogo.module.scss';
 
 export const AppLogo: React.FC<{ id?: string; size?: number; className?: string; alt?: string }> = ({ id, size = 80, className = '', alt = '' }) => {
-  const logoUrl = id ? `/api/app-image?id=${id}` : getUrl('placeholder.png');
+  const logoUrl = id ? `/api/app-image?id=${id}` : '/placeholder.png';
 
   return (
     <div aria-label={alt} className={clsx(styles.dropShadow, className)} style={{ width: size, height: size }}>

+ 1 - 2
src/client/components/StatusScreen/StatusScreen.tsx

@@ -1,6 +1,5 @@
 import Image from 'next/image';
 import React from 'react';
-import { getUrl } from '../../core/helpers/url-helpers';
 import { Button } from '../ui/Button';
 
 interface IProps {
@@ -17,7 +16,7 @@ export const StatusScreen: React.FC<IProps> = ({ title, subtitle, onAction, acti
       <Image
         alt="Tipi log"
         className="mb-3"
-        src={getUrl('tipi.png')}
+        src="/tipi.png"
         height={50}
         width={50}
         style={{

+ 1 - 2
src/client/components/ui/EmptyPage/EmptyPage.tsx

@@ -1,7 +1,6 @@
 import clsx from 'clsx';
 import Image from 'next/image';
 import React from 'react';
-import { getUrl } from '../../../core/helpers/url-helpers';
 import { Button } from '../Button';
 import styles from './EmptyPage.module.scss';
 
@@ -15,7 +14,7 @@ interface IProps {
 export const EmptyPage: React.FC<IProps> = ({ title, subtitle, onAction, actionLabel }) => (
   <div data-testid="empty-page" className="card empty">
     <Image
-      src={getUrl('empty.svg')}
+      src="/empty.svg"
       alt="Empty box"
       height="80"
       width="80"

+ 1 - 2
src/client/components/ui/ErrorPage/ErrorPage.tsx

@@ -2,7 +2,6 @@ import { IconRotateClockwise } from '@tabler/icons-react';
 import clsx from 'clsx';
 import Image from 'next/image';
 import React from 'react';
-import { getUrl } from '../../../core/helpers/url-helpers';
 import { Button } from '../Button';
 import styles from './ErrorPage.module.scss';
 
@@ -15,7 +14,7 @@ interface IProps {
 export const ErrorPage: React.FC<IProps> = ({ error, onRetry }) => (
   <div data-testid="error-page" className="card empty">
     <Image
-      src={getUrl('error.png')}
+      src="/error.png"
       alt="Empty box"
       height="100"
       width="100"

+ 1 - 2
src/client/components/ui/Header/Header.tsx

@@ -5,7 +5,6 @@ import clsx from 'clsx';
 import Link from 'next/link';
 import { Tooltip } from 'react-tooltip';
 import { useTranslations } from 'next-intl';
-import { getUrl } from '../../../core/helpers/url-helpers';
 import { useUIStore } from '../../../state/uiStore';
 import { NavBar } from '../NavBar';
 
@@ -31,7 +30,7 @@ export const Header: React.FC<IProps> = ({ isUpdateAvailable }) => {
               className={clsx('navbar-brand-image me-3')}
               width={100}
               height={100}
-              src={getUrl('tipi.png')}
+              src="/tipi.png"
               style={{
                 width: '30px',
                 maxWidth: '30px',

+ 0 - 1
src/client/core/helpers/url-helpers.ts

@@ -1 +0,0 @@
-export const getUrl = (url: string) => `/${url}`;

+ 5 - 7
src/pages/_document.tsx

@@ -1,8 +1,6 @@
 import React from 'react';
 import { Html, Head, Main, NextScript } from 'next/document';
 
-import { getUrl } from '../client/core/helpers/url-helpers';
-
 /**
  * Next.js Document component
  *
@@ -16,11 +14,11 @@ export default function MyDocument() {
         <link rel="preconnect" href="https://fonts.gstatic.com" crossOrigin="" />
         <link rel="preconnect" href="https://cdn.jsdelivr.net" />
         <link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600&display=swap" rel="stylesheet" />
-        <link rel="apple-touch-icon" sizes="180x180" href={getUrl('apple-touch-icon.png')} />
-        <link rel="icon" type="image/png" sizes="32x32" href={getUrl('favicon-32x32.png')} />
-        <link rel="icon" type="image/png" sizes="16x16" href={getUrl('favicon-16x16.png')} />
-        <link rel="manifest" href={getUrl('site.webmanifest')} />
-        <link rel="mask-icon" href={getUrl('safari-pinned-tab.svg')} color="#5bbad5" />
+        <link rel="apple-touch-icon" sizes="180x180" href="/apple-touch-icon.png" />
+        <link rel="icon" type="image/png" sizes="32x32" href="/favicon-32x32.png" />
+        <link rel="icon" type="image/png" sizes="16x16" href="/favicon-16x16.png" />
+        <link rel="manifest" href="/site.webmanifest" />
+        <link rel="mask-icon" href="/safari-pinned-tab.svg" color="#5bbad5" />
         <script src="https://cdn.jsdelivr.net/npm/@tabler/core@latest/dist/js/tabler.min.js" async />
         <meta name="msapplication-TileColor" content="#da532c" />
         <meta name="theme-color" content="#ffffff" />