Files
Investidor-V2/resources/js/pages/portfolio/shared.tsx
T

60 lines
1.9 KiB
TypeScript

import { Head, usePage } from '@inertiajs/react';
import type { ReactNode } from 'react';
export { button, control, Field, Pagination } from '../management/shared';
export type Dossier = {
id: string;
title: string;
source: string;
content: Record<string, string>;
project_id: string | null;
cluster_id: string | null;
corridor_id: string | null;
publication_status: string;
version_no?: number;
};
export const labels: Record<string, string> = {
description: 'Visão e proposta de valor',
location: 'Território',
region: 'Região',
sector: 'Sector',
promotion: 'Promoção',
facts: 'Dados indicativos da fonte',
partners: 'Investidores e parceiros',
cta: 'Próxima acção',
anchors: 'Projectos âncora e oportunidades',
gaps: 'Lacunas da cadeia de valor',
priority: 'Prioridade proposta na matriz',
clusters: 'Clusters associados',
focus: 'Investimentos complementares',
notice: 'Estado de validação',
code: 'Código',
};
export const kind = (
r: Pick<Dossier, 'project_id' | 'cluster_id' | 'corridor_id'>,
) =>
r.corridor_id ? 'Corredor' : r.cluster_id ? 'Cluster' : 'Projecto âncora';
export function Layout({
title,
children,
mainLandmark = true,
}: {
title: string;
children: ReactNode;
mainLandmark?: boolean;
}) {
const { flash } = usePage<{ flash?: { success?: string } }>().props;
const Container = mainLandmark ? 'main' : 'div';
return (
<Container className="mx-auto w-full max-w-6xl min-w-0 space-y-6 p-4 break-words md:p-8">
<Head title={title} />
<h1 className="text-3xl font-semibold">{title}</h1>
{flash?.success && (
<p role="status" className="rounded border p-3">
{flash.success}
</p>
)}
{children}
</Container>
);
}