Skip to content

Commit

Permalink
Refactor components: convert default exports to named exports and sim…
Browse files Browse the repository at this point in the history
…plify rendering logic
  • Loading branch information
joao-vasconcelos committed Jan 27, 2025
1 parent 0597aaf commit 5f8f166
Show file tree
Hide file tree
Showing 19 changed files with 28 additions and 107 deletions.
15 changes: 1 addition & 14 deletions frontend/app/(views)/(website)/alerts/[alert_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,6 @@ export async function generateMetadata({ params }): Promise<Metadata> {
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { alert_id } = await params;

//
// B. Render components

return (
<AlertsDetail alertId={alert_id} />
);

//
return <AlertsDetail alertId={alert_id} />;
}
11 changes: 0 additions & 11 deletions frontend/app/(views)/(website)/lines/[line_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,10 @@ export async function generateMetadata({ params }): Promise<Metadata> {
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { line_id } = await params;

//
// B. Render components

return (
<LinesDetailContextProvider lineId={line_id}>
<LinesDetail />
</LinesDetailContextProvider>
);

//
}
11 changes: 0 additions & 11 deletions frontend/app/(views)/(website)/news/[news_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,17 +33,6 @@ export async function generateMetadata({ params }): Promise<Metadata> {
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { news_id } = await params;

//
// B. Render components

return <NewsDetail newsId={news_id} />;

//
}
11 changes: 0 additions & 11 deletions frontend/app/(views)/(website)/stops/[stop_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,21 +41,10 @@ export async function generateMetadata({ params }): Promise<Metadata> {
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { stop_id } = await params;

//
// B. Render components

return (
<StopsDetailContextProvider stopId={stop_id}>
<StopsDetail />
</StopsDetailContextProvider>
);

//
}
2 changes: 1 addition & 1 deletion frontend/app/(views)/(website)/stores/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* * */

import StoresList from '@/components/stores/StoresList';
import { StoresList } from '@/components/stores/StoresList';

/* * */

Expand Down
9 changes: 4 additions & 5 deletions frontend/app/(views)/app-android/alerts/[alert_id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* * */

import AlertsDetail from '@/components/alerts/AlertsDetail';
import { AlertsDetail } from '@/components/alerts/AlertsDetail';

/* * */

export default function Page({ params: { alert_id } }) {
return (
<AlertsDetail alertId={alert_id} />
);
export default async function Page({ params }) {
const { alert_id } = await params;
return <AlertsDetail alertId={alert_id} />;
}
6 changes: 2 additions & 4 deletions frontend/app/(views)/app-android/alerts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* * */

import AlertsList from '@/components/alerts/AlertsList';
import { AlertsList } from '@/components/alerts/AlertsList';

/* * */

export default function Page() {
return (
<AlertsList />
);
return <AlertsList />;
}
2 changes: 1 addition & 1 deletion frontend/app/(views)/app-android/stores/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* * */

import StoresList from '@/components/stores/StoresList';
import { StoresList } from '@/components/stores/StoresList';

/* * */

Expand Down
9 changes: 4 additions & 5 deletions frontend/app/(views)/app-ios/alerts/[alert_id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* * */

import AlertsDetail from '@/components/alerts/AlertsDetail';
import { AlertsDetail } from '@/components/alerts/AlertsDetail';

/* * */

export default function Page({ params: { alert_id } }) {
return (
<AlertsDetail alertId={alert_id} />
);
export default async function Page({ params }) {
const { alert_id } = await params;
return <AlertsDetail alertId={alert_id} />;
}
6 changes: 2 additions & 4 deletions frontend/app/(views)/app-ios/alerts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* * */

import AlertsList from '@/components/alerts/AlertsList';
import { AlertsList } from '@/components/alerts/AlertsList';

/* * */

export default function Page() {
return (
<AlertsList />
);
return <AlertsList />;
}
6 changes: 2 additions & 4 deletions frontend/app/(views)/app-ios/stores/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* * */

import StoresList from '@/components/stores/StoresList';
import { StoresList } from '@/components/stores/StoresList';

/* * */

export default function Page() {
return (
<StoresList />
);
return <StoresList />;
}
9 changes: 4 additions & 5 deletions frontend/app/(views)/mupi/alerts/[alert_id]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
/* * */

import AlertsDetail from '@/components/alerts/AlertsDetail';
import { AlertsDetail } from '@/components/alerts/AlertsDetail';

/* * */

export default function Page({ params: { alert_id } }) {
return (
<AlertsDetail alertId={alert_id} />
);
export default async function Page({ params }) {
const { alert_id } = await params;
return <AlertsDetail alertId={alert_id} />;
}
6 changes: 2 additions & 4 deletions frontend/app/(views)/mupi/alerts/page.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
/* * */

import AlertsList from '@/components/alerts/AlertsList';
import { AlertsList } from '@/components/alerts/AlertsList';

/* * */

export default function Page() {
return (
<AlertsList />
);
return <AlertsList />;
}
11 changes: 0 additions & 11 deletions frontend/app/(views)/mupi/lines/[line_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ import { LinesDetailContextProvider } from '@/contexts/LinesDetail.context';
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { line_id } = await params;

//
// B. Render components

return (
<LinesDetailContextProvider lineId={line_id}>
<LinesDetail />
</LinesDetailContextProvider>
);

//
}
11 changes: 0 additions & 11 deletions frontend/app/(views)/mupi/stops/[stop_id]/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,10 @@ import { StopsDetailContextProvider } from '@/contexts/StopsDetail.context';
/* * */

export default async function Page({ params }) {
//

//
// A. Setup variables

const { stop_id } = await params;

//
// B. Render components

return (
<StopsDetailContextProvider stopId={stop_id}>
<StopsDetail />
</StopsDetailContextProvider>
);

//
}
4 changes: 2 additions & 2 deletions frontend/components/alerts/AlertsList/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* * */

import AlertsListGroup from '@/components/alerts/AlertsListGroup';
import AlertsListToolbar from '@/components/alerts/AlertsListToolbar';
import { AlertsListGroup } from '@/components/alerts/AlertsListGroup';
import { AlertsListToolbar } from '@/components/alerts/AlertsListToolbar';

/* * */

Expand Down
2 changes: 1 addition & 1 deletion frontend/components/alerts/AlertsListGroup/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { useMemo } from 'react';

/* * */

export default function Component() {
export function AlertsListGroup() {
//

//
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/alerts/AlertsListToolbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import styles from './styles.module.css';

/* * */

export default function Component() {
export function AlertsListToolbar() {
//

//
Expand Down
2 changes: 1 addition & 1 deletion frontend/components/stores/StoresList/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import styles from './styles.module.css';

/* * */

export default function Component() {
export function StoresList() {
return (
<>
<StoresListToolbar />
Expand Down

0 comments on commit 5f8f166

Please sign in to comment.