Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: change extended voie #956

Merged
merged 7 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions components/bal/voies-list.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ function VoiesList({
: null
}
comment={
voie.commentedNumeros.length > 0 ? (
<CommentsContent comments={voie.commentedNumeros} />
voie.comments.length > 0 ? (
<CommentsContent comments={voie.comments} />
) : null
}
warning={
Expand Down
17 changes: 5 additions & 12 deletions components/comments-content.tsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
import { Pane, Text } from "evergreen-ui";
import { uniqueId } from "lodash";

const COMMENTS_LIMIT = 10;

interface CommentsContentProps {
comments: {
id: string;
numero: number;
suffixe: string;
comment: string;
}[];
comments: string[];
}

function CommentsContent({ comments }: CommentsContentProps) {
Expand All @@ -23,18 +19,15 @@ function CommentsContent({ comments }: CommentsContentProps) {
Commentaire{`${comments.length > 0 ? "s" : ""}`} :
</Text>
</Pane>
{filteredComments.map(({ id, numero, suffixe, comment }) => (
{filteredComments.map((comment) => (
<Pane
color="white"
key={id}
key={uniqueId()}
whiteSpace="nowrap"
overflow="hidden"
textOverflow="ellipsis"
>
<Text color="white">
• {numero}
{suffixe} : {comment}
</Text>
<Text color="white">{comment}</Text>
</Pane>
))}
{nbComments > COMMENTS_LIMIT && (
Expand Down
4 changes: 2 additions & 2 deletions lib/openapi/models/ExtendedVoieDTO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ export type ExtendedVoieDTO = {
typeNumerotation: ExtendedVoieDTO.typeNumerotation;
centroid: Record<string, any>;
trace: Record<string, any>;
bbox: Array<string>;
baseLocale: BaseLocale;
numeros: Array<Numero>;
nbNumeros: number;
nbNumerosCertifies: number;
isAllCertified: boolean;
commentedNumeros: Array<string>;
bbox: Record<string, any>;
comments: Array<string>;
};

export namespace ExtendedVoieDTO {
Expand Down
1 change: 1 addition & 0 deletions lib/openapi/models/Voie.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type Voie = {
typeNumerotation: Voie.typeNumerotation;
centroid: Record<string, any>;
trace: Record<string, any>;
bbox: Array<string>;
baseLocale: BaseLocale;
numeros: Array<Numero>;
};
Expand Down
Loading