Skip to content

Commit

Permalink
Lint updates
Browse files Browse the repository at this point in the history
  • Loading branch information
joao-vasconcelos committed Dec 30, 2024
1 parent a0f8d9e commit e0b31f3
Show file tree
Hide file tree
Showing 37 changed files with 133 additions and 210 deletions.
2 changes: 1 addition & 1 deletion frontend/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* * */

import { availableFormats } from '@/i18n/config';
import { Inter } from 'next/font/google';
import { NextIntlClientProvider } from 'next-intl';
import { getLocale, getMessages } from 'next-intl/server';
import { Inter } from 'next/font/google';
import { NuqsAdapter } from 'nuqs/adapters/next/app';

/* * */
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/add-device/Error/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
/* * */

import { Section } from '@/components/layout/Section';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';

import styles from './styles.module.css';
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/add-device/Page/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* * */

import { Section } from '@/components/layout/Section';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/navigation';
import { useEffect, useState } from 'react';

import styles from './styles.module.css';
Expand Down
20 changes: 9 additions & 11 deletions frontend/components/alerts/AlertActivePeriod/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,19 @@ import styles from './styles.module.css';

/* * */

interface AlertActivePeriodEndProps {
date?: Date
size?: 'md' | 'sm'
}

interface AlertActivePeriodStartProps {
date?: Date
size?: 'md' | 'sm'
}

/* * */

export function AlertActivePeriodStart({ date, size = 'md' }: AlertActivePeriodStartProps) {
export function AlertActivePeriodEnd({ date, size = 'md' }: AlertActivePeriodEndProps) {
//

//
Expand All @@ -25,22 +30,15 @@ export function AlertActivePeriodStart({ date, size = 'md' }: AlertActivePeriodS
// B. Render components

if (date) {
return <p className={`${styles.text} ${styles[size]}`}>{t.rich('start', { parsedDate: chunks => <strong>{chunks}</strong>, start: date })}</p>;
return <p className={`${styles.text} ${styles[size]}`}>{t.rich('end', { end: date, parsedDate: chunks => <strong>{chunks}</strong> })}</p>;
}

//
}

/* * */

interface AlertActivePeriodEndProps {
date?: Date
size?: 'md' | 'sm'
}

/* * */

export function AlertActivePeriodEnd({ date, size = 'md' }: AlertActivePeriodEndProps) {
export function AlertActivePeriodStart({ date, size = 'md' }: AlertActivePeriodStartProps) {
//

//
Expand All @@ -52,7 +50,7 @@ export function AlertActivePeriodEnd({ date, size = 'md' }: AlertActivePeriodEnd
// B. Render components

if (date) {
return <p className={`${styles.text} ${styles[size]}`}>{t.rich('end', { end: date, parsedDate: chunks => <strong>{chunks}</strong> })}</p>;
return <p className={`${styles.text} ${styles[size]}`}>{t.rich('start', { parsedDate: chunks => <strong>{chunks}</strong>, start: date })}</p>;
}

//
Expand Down
14 changes: 6 additions & 8 deletions frontend/components/alerts/AlertCauseEffectIcon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ interface AlertCauseIconProps {
withText?: boolean
}

interface AlertEffectIconProps {
className?: string
effect?: AlertEffect
withText?: boolean
}

/* * */

export function AlertCauseIcon({ cause, className, withText = false }: AlertCauseIconProps) {
Expand Down Expand Up @@ -96,14 +102,6 @@ export function AlertCauseIcon({ cause, className, withText = false }: AlertCaus

/* * */

interface AlertEffectIconProps {
className?: string
effect?: AlertEffect
withText?: boolean
}

/* * */

export function AlertEffectIcon({ className, effect, withText = false }: AlertEffectIconProps) {
//

Expand Down
4 changes: 1 addition & 3 deletions frontend/components/analytics/ConsentPopup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,10 @@

import { Logo } from '@/components/header/Logo';
import { useAnalyticsContext } from '@/contexts/Analytics.context';
// import { BrandsCmet } from '@/settings/assets.settings';
import { Button, Modal } from '@mantine/core';
// import Image from 'next/image';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { usePathname } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useEffect, useState } from 'react';

import styles from './styles.module.css';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { useEnvironmentContext } from '@/contexts/Environment.context';
import { URLS } from '@/settings/urls.settings';
import { Button } from '@mantine/core';
import { IconArrowBigUpLinesFilled } from '@tabler/icons-react';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/app/AppStartupMessageDefault/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useEnvironmentContext } from '@/contexts/Environment.context';
import { URLS } from '@/settings/urls.settings';
import { Player } from '@lottiefiles/react-lottie-player';
import { Button } from '@mantine/core';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/cards/Discounts/index.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
/* * */

import { Surface } from '@/components/layout/Surface';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/common/BackButton/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

import { useEnvironmentContext } from '@/contexts/Environment.context';
import { IconArrowLeft } from '@tabler/icons-react';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useMemo } from 'react';

import styles from './styles.module.css';
Expand Down
15 changes: 9 additions & 6 deletions frontend/components/common/Combobox/index.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,8 @@
/* * */

import { Combobox, InputBase, useCombobox } from '@mantine/core';
import { useState } from 'react';

// Define interfaces for the data structure
interface ComboboxGroupData {
group: string
items: string[]
}

export interface ComboboxProps {
data: ComboboxGroupData[] | string[]
label?: string // Optional label for the combobox
Expand All @@ -15,6 +11,13 @@ export interface ComboboxProps {
searchable?: boolean // Enables search functionality
}

interface ComboboxGroupData {
group: string
items: string[]
}

/* * */

const isGroupedData = (data: ComboboxGroupData[] | string[]): data is ComboboxGroupData[] => {
return Array.isArray(data) && data.length > 0 && typeof data[0] === 'object' && 'group' in data[0];
};
Expand Down
10 changes: 7 additions & 3 deletions frontend/components/common/LineBadgeBaseIcon/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
interface Variant {
variant: 'inter-regional' | 'longa' | 'mar' | 'proxima' | 'rapida'
}
/* * */

interface Fill {
fill: string
}

type Props = Fill | Variant;

interface Variant {
variant: 'inter-regional' | 'longa' | 'mar' | 'proxima' | 'rapida'
}

/* * */

export default function Component(props: Props) {
let fillColor = '';

Expand Down
14 changes: 7 additions & 7 deletions frontend/components/common/NextArrivals/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@ import styles from './styles.module.css';

/* * */

interface Props {
allowPastArrivals?: boolean
arrivals: number[]
status: ArrivalStatus
withIcon?: boolean
}

interface NextArrival {
estimated_arrival_hours: number
estimated_arrival_minutes: number
Expand All @@ -27,6 +20,13 @@ interface NextArrival {
label: string
}

interface Props {
allowPastArrivals?: boolean
arrivals: number[]
status: ArrivalStatus
withIcon?: boolean
}

/* * */

export function NextArrivals({ allowPastArrivals = true, arrivals, status, withIcon = true }: Props) {
Expand Down
18 changes: 8 additions & 10 deletions frontend/components/common/TimetableSchedules/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ import styles from './styles.module.css';

/* * */

interface TimetableSchedulesMinuteProps {
isHighlighted: boolean
minuteData: Minute
onClick?: () => void
selectedExceptionIds: string[]
setSelectedExceptionIds: (values: string[]) => void
}

interface TimetableSchedulesProps {
selectedExceptionIds: string[]
setSelectedExceptionIds: (values: string[]) => void
Expand Down Expand Up @@ -59,16 +67,6 @@ export default function TimetableSchedules({ selectedExceptionIds, setSelectedEx

/* * */

interface TimetableSchedulesMinuteProps {
isHighlighted: boolean
minuteData: Minute
onClick?: () => void
selectedExceptionIds: string[]
setSelectedExceptionIds: (values: string[]) => void
}

/* * */

function TimetableSchedulesMinute({ isHighlighted, minuteData, onClick, selectedExceptionIds, setSelectedExceptionIds }: TimetableSchedulesMinuteProps) {
//

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/contacts/Page/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Surface } from '@/components/layout/Surface';
import { IconsCommon } from '@/settings/assets.settings';
import { Routes } from '@/utils/routes';
import { IconPhone, IconUmbrella } from '@tabler/icons-react';
import Image from 'next/image';
import { useTranslations } from 'next-intl';
import Image from 'next/image';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/footer/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Section } from '@/components/layout/Section';
import { Surface } from '@/components/layout/Surface';
import { useDebugContext } from '@/contexts/Debug.context';
import { footerNavigationGroup } from '@/settings/navigation.settings';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/helpdesks/WhereToBuy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import { Section } from '@/components/layout/Section';
import { Surface } from '@/components/layout/Surface';
import { ThemeSwitch } from '@/components/responsive/ThemeSwitch';
import { Image } from '@mantine/core';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/home/MainCarouselCard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
import { ImagesCommon } from '@/settings/assets.settings';
import { Image } from '@mantine/core';
import { IconArrowRight } from '@tabler/icons-react';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';

import styles from './styles.module.css';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/home/MetricsSection/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import { Surface } from '@/components/layout/Surface';
import { MetricsDemandChart } from '@/components/metrics/MetricsDemandChart';
import { Routes } from '@/utils/routes';
import { DateTime } from 'luxon';
import Link from 'next/link';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useMemo } from 'react';
import useSWR from 'swr';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import styles from './styles.module.css';

/* * */

export default function Component() {
export function MetricsSectionDemandSkeleton() {
return (
<div className={styles.container}>
<div className={styles.skeletonWrapper}>
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/home/QuickSearchFavoritesBar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import { LineBadge } from '@/components/lines/LineBadge';
import { useAlertsContext } from '@/contexts/Alerts.context';
import { useProfileContext } from '@/contexts/Profile.context';
import { Routes, RoutesSchedule } from '@/utils/routes';
import { useTranslations } from 'next-intl';
import Link from 'next/link';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useMemo } from 'react';
import useSWR from 'swr';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/home/QuickSearchWidget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import { SelectLine } from '@/components/common/SelectLine';
import { SelectStop } from '@/components/common/SelectStop';
import { Routes } from '@/utils/routes';
import { SegmentedControl } from '@mantine/core';
import { useRouter } from 'next/navigation';
import { useTranslations } from 'next-intl';
import { useRouter } from 'next/navigation';
import { useState } from 'react';
import useSWR from 'swr';

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/layout/Surface/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ interface Props {
children?: React.ReactNode
forceOverflow?: boolean
fullHeight?: boolean
variant?: 'alerts' | 'brand' | 'brand2' | 'debug' | 'default' | 'muted' | 'persistent' | 'standout' | 'success' | 'warning'
variant?: 'alerts' | 'brand2' | 'brand' | 'debug' | 'default' | 'muted' | 'persistent' | 'standout' | 'success' | 'warning'
}

/* * */
Expand Down
Loading

0 comments on commit e0b31f3

Please sign in to comment.