Skip to content

Commit

Permalink
[Semaphore] add url in semaphore card
Browse files Browse the repository at this point in the history
  • Loading branch information
claire2212 committed Sep 4, 2024
1 parent e06fca4 commit de3e87a
Show file tree
Hide file tree
Showing 11 changed files with 69 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ data class SemaphoreEntity(
val email: String? = null,
val phoneNumber: String? = null,
val base: String? = null,
val url: String? = null,
)
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ data class SemaphoreDataOutput(
val email: String?,
val phoneNumber: String?,
val base: String?,
val url: String?,
) {
companion object {
fun fromSemaphoreEntity(semaphore: SemaphoreEntity) = SemaphoreDataOutput(
Expand All @@ -27,6 +28,7 @@ data class SemaphoreDataOutput(
email = semaphore.email,
phoneNumber = semaphore.phoneNumber,
base = semaphore.base,
url = semaphore.url,
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,35 +13,29 @@ data class SemaphoreModel(
@Id
@Column(name = "id")
val id: Int,
@Column(name = "geom")
val geom: Point,
@Column(name = "nom")
val name: String,
@Column(name = "dept")
val department: String? = null,
@Column(name = "facade")
val facade: String? = null,
@Column(name = "administration")
val administration: String? = null,
@Column(name = "unite")
val unit: String? = null,
@Column(name = "email")
val email: String? = null,
@Column(name = "telephone")
val phoneNumber: String? = null,
@Column(name = "base")
val base: String? = null,
@Column(name = "geom") val geom: Point,
@Column(name = "nom") val name: String,
@Column(name = "dept") val department: String? = null,
@Column(name = "facade") val facade: String? = null,
@Column(name = "administration") val administration: String? = null,
@Column(name = "unite") val unit: String? = null,
@Column(name = "email") val email: String? = null,
@Column(name = "telephone") val phoneNumber: String? = null,
@Column(name = "base") val base: String? = null,
@Column(name = "url") val url: String? = null,
) {
fun toSemaphore() = SemaphoreEntity(
id = id,
geom = geom,
name = name,
department = department,
facade = facade,
administration = administration,
unit = unit,
email = email,
phoneNumber = phoneNumber,
base = base,
)
fun toSemaphore() =
SemaphoreEntity(
id = id,
geom = geom,
name = name,
department = department,
facade = facade,
administration = administration,
unit = unit,
email = email,
phoneNumber = phoneNumber,
base = base,
url = url,
)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ALTER TABLE public.semaphores ADD COLUMN url text DEFAULT NULL;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@

INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (21, '0101000020E61000006E7F90A1B28312C0A4703D0AD7234840', 'SEMAPHORE LE TOULINGUET', '29', 'NAMO', NULL, NULL, NULL, NULL, NULL);
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (22, '0101000020E610000075B9FD4186CA0BC0BD9A7856346A4840', 'SEMAPHORE PLOUMANAC''H', '22', 'NAMO', 'FOSIT', 'Sémaphore de Ploumanac’h', '[email protected]', '01 23 45 67 89', 'Ploumana’ch');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (23, '0101000020E6100000E09B5713CF0A02C052B81E85EB514840', 'SEMAPHORE SAINT CAST', '22', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Cast', '[email protected]', '01 23 45 67 89', 'Saint-Cast-le-Guildo');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (24, '0101000020E610000001DFBC9A781613C05813CF8A462A4840', 'SEMAPHORE SAINT MATHIEU', '29', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Mathieu', '[email protected]', '01 23 45 67 89', 'Plougonvelin');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (25, '0101000020E6100000F4499FF4499F06C08C25BF58F2534840', 'SEMAPHORE ST QUAY PORTRIEUX', '22', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Quay', '[email protected]', '01 23 45 67 89', 'Saint-Quay-Portieux');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (32, '0101000020E61000003A6DA0D306BA0240A70D74DA40874940', 'SEMAPHORE DUNKERQUE', '59', 'MEMN', 'FOSIT', 'Sémaphore de Dunkerque', '[email protected]', '01 23 45 67 89', 'Dunkerque');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (33, '0101000020E6100000EA72FB830C95F93FF6285C8FC25D4940', 'SEMAPHORE BOULOGNE', '62', 'MEMN', 'FOSIT', 'Sémaphore de Boulogne sur mer', '[email protected]', '01 23 45 67 89', 'Boulogne-sur-Mer');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (34, '0101000020E61000009C5713CF8A46F73F8B4602BE790D4940', 'SEMAPHORE AULT', '80', 'MEMN', 'FOSIT', 'Sémaphore d’Ault', '[email protected]', '01 23 45 67 89', 'Ault');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (35, '0101000020E6100000C850D961EA72F13FDDFE204365F74840', 'SEMAPHORE DIEPPE', '76', 'MEMN', 'FOSIT', 'Sémaphore de Dieppe', '[email protected]', '01 23 45 67 89', 'Dieppe');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base) VALUES (36, '0101000020E6100000BCBBBBBBBBBBD73F5813CF8A46E24840', 'SEMAPHORE FECAMP', '76', 'MEMN', 'FOSIT', 'Sémaphore de Fécamp', '[email protected]', '01 23 45 67 89', 'Fécamp');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (21, '0101000020E61000006E7F90A1B28312C0A4703D0AD7234840', 'SEMAPHORE LE TOULINGUET', '29', 'NAMO', NULL, NULL, NULL, NULL, NULL, 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (22, '0101000020E610000075B9FD4186CA0BC0BD9A7856346A4840', 'SEMAPHORE PLOUMANAC''H', '22', 'NAMO', 'FOSIT', 'Sémaphore de Ploumanac’h', '[email protected]', '01 23 45 67 89', 'Ploumana’ch', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (23, '0101000020E6100000E09B5713CF0A02C052B81E85EB514840', 'SEMAPHORE SAINT CAST', '22', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Cast', '[email protected]', '01 23 45 67 89', 'Saint-Cast-le-Guildo', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (24, '0101000020E610000001DFBC9A781613C05813CF8A462A4840', 'SEMAPHORE SAINT MATHIEU', '29', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Mathieu', '[email protected]', '01 23 45 67 89', 'Plougonvelin', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (25, '0101000020E6100000F4499FF4499F06C08C25BF58F2534840', 'SEMAPHORE ST QUAY PORTRIEUX', '22', 'NAMO', 'FOSIT', 'Sémaphore de Saint-Quay', '[email protected]', '01 23 45 67 89', 'Saint-Quay-Portieux', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (32, '0101000020E61000003A6DA0D306BA0240A70D74DA40874940', 'SEMAPHORE DUNKERQUE', '59', 'MEMN', 'FOSIT', 'Sémaphore de Dunkerque', '[email protected]', '01 23 45 67 89', 'Dunkerque', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (33, '0101000020E6100000EA72FB830C95F93FF6285C8FC25D4940', 'SEMAPHORE BOULOGNE', '62', 'MEMN', 'FOSIT', 'Sémaphore de Boulogne sur mer', '[email protected]', '01 23 45 67 89', 'Boulogne-sur-Mer', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (34, '0101000020E61000009C5713CF8A46F73F8B4602BE790D4940', 'SEMAPHORE AULT', '80', 'MEMN', 'FOSIT', 'Sémaphore d’Ault', '[email protected]', '01 23 45 67 89', 'Ault', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (35, '0101000020E6100000C850D961EA72F13FDDFE204365F74840', 'SEMAPHORE DIEPPE', '76', 'MEMN', 'FOSIT', 'Sémaphore de Dieppe', '[email protected]', '01 23 45 67 89', 'Dieppe', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
INSERT INTO semaphores (id, geom, nom, dept, facade, administration, unite, email, telephone, base, "url") VALUES (36, '0101000020E6100000BCBBBBBBBBBBD73F5813CF8A46E24840', 'SEMAPHORE FECAMP', '76', 'MEMN', 'FOSIT', 'Sémaphore de Fécamp', '[email protected]', '01 23 45 67 89', 'Fécamp', 'https://extranet.legicem.metier.developpement-durable.gouv.fr/fiches-d-appui-semaphores-atlantique-r2370.html');
4 changes: 2 additions & 2 deletions datascience/src/pipeline/flows/semaphores.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@ def load_semaphores(semaphores: pd.DataFrame):
table_id_column="id",
init_ddls=[
DDL(
"ALTER TABLE public.reportings "
"ALTER TABLE public.reportings_source "
"DROP CONSTRAINT fk_semaphores;"
)
],
end_ddls=[
DDL(
"ALTER TABLE public.reportings "
"ALTER TABLE public.reportings_source "
"ADD CONSTRAINT fk_semaphores "
"FOREIGN KEY (semaphore_id) REFERENCES public.semaphores (id);"
)
Expand Down
3 changes: 2 additions & 1 deletion datascience/src/pipeline/queries/cross/cacem/semaphore.sql
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ SELECT
unite,
email,
telephone,
base
base,
"url"
FROM prod.semaphore
WHERE geom IS NOT NULL and nom IS NOT NULL
2 changes: 1 addition & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/src/domain/entities/semaphore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,5 @@ export type Semaphore = {
name: string
phoneNumber: string | undefined | null
unit: string | undefined | null
url: string | undefined | null
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ export const getSemaphoreZoneFeature = (semaphore: Semaphore, layername: string)
name: semaphore.name,
overlayCoordinates: undefined,
phoneNumber: semaphore.phoneNumber,
unit: semaphore.unit
unit: semaphore.unit,
url: semaphore.url
})

return feature
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export function SemaphoreCard({ feature, isSuperUser, selected = false }: Semaph
const displaySemaphoresLayer = useAppSelector(state => state.global.displaySemaphoresLayer)
const hasMapInteraction = useHasMapInteraction()

const { email, id, name, phoneNumber, unit } = feature.getProperties()
const { email, id, name, phoneNumber, unit, url } = feature.getProperties()
const [tooltipPhoneState, setTooltipPhoneState] = useState(PHONE_TOOLTIP_STATE.hover)

const [tooltipMailState, setTooltipMailState] = useState(MAIL_TOOLTIP_STATE.hover)
Expand Down Expand Up @@ -151,6 +151,14 @@ export function SemaphoreCard({ feature, isSuperUser, selected = false }: Semaph
<span>{email}</span>
</StyledContactLine>
)}
{url && (
<UrlContainer>
<StyledIcon color={THEME.color.gunMetal} />
<UrlLink href={url} target="_blank">
Lien vers la fiche Légicem du sémaphore
</UrlLink>
</UrlContainer>
)}

<StyledButton Icon={Icon.Plus} isFullWidth onClick={createSemaphoreReporting}>
Créer un signalement
Expand Down Expand Up @@ -234,3 +242,17 @@ const StyledButton = styled(Button)`
padding: 4px 12px;
margin-top: 16px;
`
const UrlContainer = styled.div`
display: flex;
flex-direction: row;
gap: 6px;
`
const StyledIcon = styled(Icon.SortSelectedDown)`
rotate: -90deg;
`
const UrlLink = styled.a`
color: ${p => p.theme.color.gunMetal};
font-size: 13px;
cursor: pointer;
font-weight: 500;
`

0 comments on commit de3e87a

Please sign in to comment.