Skip to content

Commit bd97d60

Browse files
authored
Améliore l'affichage responsive du sticky header (#678)
* remove slot in audit header * add items in header dropdown in small viewports * improve filters display on small viewports * set all media queries in rem * harmonize usage of media queries * document media queries usage * update changelog
1 parent 6eeab0c commit bd97d60

11 files changed

Lines changed: 173 additions & 120 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ Tous les changements notables de Ara sont documentés ici avec leur date, leur c
44

55
## 07/03/2024
66

7+
### Corrections 🐛
8+
9+
- Améliorer l’affichage sur mobile du header sticky sur la page de génération de l’audit ([#678](https://github.com/DISIC/Ara/pull/678))
10+
711
### Autres changements ⚙️
812

913
- Supprime la rubrique des ressources ([#675](https://github.com/DISIC/Ara/pull/675))

confiture-web-app/README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,12 @@ Les tests peuvent être lancés de 2 manières :
4848
```sh
4949
yarn cypress run
5050
```
51+
52+
## Guidelines
53+
54+
- Utiliser les media queries en "desktop first" et avec la notation suivante avec les [valeurs de points de rupture du DSFR](https://www.systeme-de-design.gouv.fr/elements-d-interface/fondamentaux-techniques/grille-et-points-de-rupture) :
55+
```css
56+
@media (width < 62rem) {
57+
...
58+
}
59+
```

confiture-web-app/src/components/SummaryCard.vue

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -86,11 +86,7 @@ const uniqueId = useUniqueId();
8686
color: var(--text-mention-grey);
8787
}
8888
89-
@media (max-width: 992px) {
90-
.card {
91-
flex-direction: column;
92-
}
93-
89+
@media (width < 48rem) {
9490
.card-info {
9591
text-align: center;
9692
}

confiture-web-app/src/components/audit/AuditGenerationHeader.vue

Lines changed: 135 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import AuditProgressBar from "./AuditProgressBar.vue";
2121
import DeleteModal from "./DeleteModal.vue";
2222
import Dropdown from "../ui/Dropdown.vue";
2323
import DuplicateModal from "./DuplicateModal.vue";
24+
import NotesModal from "../../components/audit/NotesModal.vue";
2425
import SaveIndicator from "./SaveIndicator.vue";
2526
import SummaryCard from "../SummaryCard.vue";
2627
import CopyIcon from "../icons/CopyIcon.vue";
@@ -128,6 +129,40 @@ function confirmDelete() {
128129
});
129130
}
130131
132+
/**
133+
* Update audit notes
134+
*/
135+
const notesModal = ref<InstanceType<typeof NotesModal>>();
136+
const isNotesLoading = ref(false);
137+
138+
function openNotesModal() {
139+
notesModal.value?.show();
140+
}
141+
142+
const updateAuditNotes = async (notes: string) => {
143+
isNotesLoading.value = true;
144+
try {
145+
await auditStore.updateAuditNotes(uniqueId.value, {
146+
notes
147+
});
148+
notify(
149+
"success",
150+
undefined,
151+
"Annotation de l’audit mise à jour avec succès"
152+
);
153+
} catch (error) {
154+
console.error(error);
155+
notify(
156+
"error",
157+
"Une erreur est survenue",
158+
"Un problème empêche la sauvegarde de vos données. Contactez-nous à l'adresse ara@design.numerique.gouv.fr si le problème persiste."
159+
);
160+
} finally {
161+
isNotesLoading.value = false;
162+
notesModal.value?.hide();
163+
}
164+
};
165+
131166
const route = useRoute();
132167
const uniqueId = computed(() => route.params.uniqueId as string);
133168
@@ -191,8 +226,6 @@ onMounted(() => {
191226

192227
<h1>{{ auditName }}</h1>
193228

194-
<!-- TODO: Link to actions somehow -->
195-
196229
<div
197230
id="sticky-indicator"
198231
class="sticky-indicator fr-grid-row fr-p-0 fr-mb-3w"
@@ -212,7 +245,7 @@ onMounted(() => {
212245
</div>
213246

214247
<div
215-
class="indicator-left-side fr-col-12 fr-col-md-3"
248+
class="indicator-left-side fr-col-12 fr-col-sm-5 fr-col-md-3"
216249
:class="{ 'with-border': showLeftSideBorders }"
217250
>
218251
<AuditProgressBar
@@ -249,13 +282,13 @@ onMounted(() => {
249282
</div>
250283
</div>
251284

252-
<div class="fr-col-12 fr-col-md-9 sub-header">
285+
<div class="fr-col-12 fr-col-sm-7 fr-col-md-9 sub-header">
253286
<SaveIndicator
254287
v-if="route.name === 'audit-generation'"
255288
class="fr-ml-2w"
256289
/>
257290
<ul class="top-actions fr-my-0 fr-p-0" role="list">
258-
<li>
291+
<li class="fr-p-0 settings-item">
259292
<RouterLink
260293
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-settings-5-line"
261294
:to="{
@@ -267,39 +300,71 @@ onMounted(() => {
267300
</RouterLink>
268301
</li>
269302

270-
<li>
303+
<li class="fr-p-0">
271304
<Dropdown
272305
ref="optionsDropdownRef"
273306
title="Actions"
274307
:disabled="isOffline"
275-
:align-left="route.name === 'audit-generation'"
276308
>
277309
<ul role="list" class="fr-p-0 fr-m-0 dropdown-list">
278-
<template v-if="!!auditPublicationDate">
279-
<li class="dropdown-item">
280-
<RouterLink
281-
:to="{
282-
name: 'audit-generation',
283-
params: { uniqueId: editUniqueId }
284-
}"
285-
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-edit-line fr-m-0"
286-
>
287-
Modifier l’audit
288-
</RouterLink>
289-
</li>
290-
</template>
310+
<li class="dropdown-item mobile-dropdown-item">
311+
<button
312+
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-draft-line"
313+
:disabled="isOffline"
314+
@click="openNotesModal"
315+
>
316+
Annoter l’audit
317+
</button>
318+
</li>
319+
<li
320+
aria-hidden="true"
321+
class="dropdown-separator mobile-dropdown-item"
322+
/>
291323
<li class="dropdown-item">
292324
<button
293-
class="fr-btn fr-btn--tertiary-no-outline fr-m-0"
325+
class="fr-btn fr-btn--tertiary-no-outline"
294326
@click="duplicateModal?.show()"
295327
>
296328
<CopyIcon class="fr-mr-2v" />
297329
Créer une copie
298330
</button>
299331
</li>
332+
<li class="fr-p-0 settings-item mobile-dropdown-item">
333+
<RouterLink
334+
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-settings-5-line"
335+
:to="{
336+
name: 'audit-settings',
337+
params: { uniqueId: editUniqueId }
338+
}"
339+
>
340+
Accéder aux paramètres
341+
</RouterLink>
342+
</li>
343+
<li
344+
aria-hidden="true"
345+
class="dropdown-separator mobile-dropdown-item"
346+
/>
347+
<li class="fr-p-0 report-item mobile-dropdown-item">
348+
<component
349+
:is="isOffline ? 'button' : 'RouterLink'"
350+
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-eye-line no-external-icon"
351+
:to="{
352+
name: 'report',
353+
params: {
354+
uniqueId: auditStore.currentAudit?.consultUniqueId
355+
}
356+
}"
357+
target="_blank"
358+
:disabled="isOffline"
359+
>
360+
Consulter le rapport
361+
<span class="sr-only">(Nouvelle fenêtre)</span>
362+
</component>
363+
</li>
364+
<li aria-hidden="true" class="dropdown-separator" />
300365
<li class="dropdown-item">
301366
<a
302-
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-download-fill fr-m-0 download-link"
367+
class="fr-btn fr-btn--tertiary-no-outline fr-btn--icon-left fr-icon-download-fill download-link"
303368
:href="csvExportUrl"
304369
:download="csvExportFilename"
305370
>
@@ -322,7 +387,31 @@ onMounted(() => {
322387
</Dropdown>
323388
</li>
324389

325-
<slot name="actions" />
390+
<li class="fr-p-0 notes-item">
391+
<button
392+
class="fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-draft-line"
393+
:disabled="isOffline"
394+
@click="openNotesModal"
395+
>
396+
Annoter l’audit
397+
</button>
398+
</li>
399+
400+
<li class="fr-p-0 report-item">
401+
<component
402+
:is="isOffline ? 'button' : 'RouterLink'"
403+
class="fr-btn fr-btn--secondary fr-btn--icon-left fr-icon-eye-line no-external-icon"
404+
:to="{
405+
name: 'report',
406+
params: { uniqueId: auditStore.currentAudit?.consultUniqueId }
407+
}"
408+
target="_blank"
409+
:disabled="isOffline"
410+
>
411+
Consulter le rapport
412+
<span class="sr-only">(Nouvelle fenêtre)</span>
413+
</component>
414+
</li>
326415
</ul>
327416
</div>
328417
</div>
@@ -382,6 +471,12 @@ onMounted(() => {
382471
optionsDropdownRef?.closeOptions();
383472
"
384473
/>
474+
475+
<NotesModal
476+
ref="notesModal"
477+
:is-loading="isNotesLoading"
478+
@confirm="updateAuditNotes"
479+
/>
385480
</template>
386481

387482
<style scoped>
@@ -416,9 +511,6 @@ onMounted(() => {
416511
flex-basis: 100%;
417512
color: var(--text-mention-grey);
418513
}
419-
:deep(.top-actions > li) {
420-
padding-bottom: 0;
421-
}
422514
423515
.delete-button {
424516
color: var(--error-425-625);
@@ -456,12 +548,6 @@ onMounted(() => {
456548
min-height: 4rem;
457549
}
458550
459-
@media (min-width: 62em) {
460-
.sticky-indicator {
461-
z-index: 3;
462-
}
463-
}
464-
465551
.audit-status {
466552
display: flex;
467553
align-items: center;
@@ -497,4 +583,21 @@ onMounted(() => {
497583
.progress-bar {
498584
flex-grow: 1;
499585
}
586+
587+
/* Display / Hide items from the menu in the toolbar or in the dropdown */
588+
.mobile-dropdown-item {
589+
display: none;
590+
}
591+
592+
@media (width < 62rem) {
593+
.mobile-dropdown-item {
594+
display: block;
595+
}
596+
597+
.settings-item:not(.mobile-dropdown-item),
598+
.notes-item:not(.mobile-dropdown-item),
599+
.report-item:not(.mobile-dropdown-item) {
600+
display: none;
601+
}
602+
}
500603
</style>

confiture-web-app/src/components/audit/TestEnvironmentSelection/TestEnvironmentSelection.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -455,13 +455,13 @@ function combineEnvironments(
455455
grid-column: 1 / -1;
456456
}
457457
458-
@media (max-width: 992px) {
458+
@media (width < 62rem) {
459459
.suggested-environments {
460460
grid-template-columns: 1fr 1fr;
461461
}
462462
}
463463
464-
@media (max-width: 576px) {
464+
@media (width < 36rem) {
465465
.suggested-environments {
466466
grid-template-columns: 1fr;
467467
}

confiture-web-app/src/components/overview/AuditStep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ const auditIsInProgress = computed(() => {
266266
grid-column: 1;
267267
}
268268
269-
@media (max-width: 48rem) {
269+
@media (width < 48rem) {
270270
.audit-step-charts {
271271
grid-template-columns: 1fr;
272272
gap: 1rem;

confiture-web-app/src/components/overview/StatementStep.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ const auditIsPublishable = computed(() => {
166166
grid-row: 4;
167167
}
168168
169-
@media (max-width: 48rem) {
169+
@media (width < 48rem) {
170170
.statement-step-actions > li:first-child {
171171
width: 100%;
172172
}

confiture-web-app/src/components/report/ReportErrors.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -786,7 +786,7 @@ function updateActiveAnchorLink(id: string, event: MouseEvent) {
786786
content: none;
787787
}
788788
789-
@media (max-width: 768px) {
789+
@media (width < 48rem) {
790790
.main {
791791
grid-template-columns: 1fr;
792792
}

confiture-web-app/src/components/report/ReportResults.vue

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,10 +239,14 @@ const auditInProgress = computed(
239239
}
240240
241241
/* To avoid JS based MQ, we replicate `fr-table--layout-fixed` */
242-
@media (min-width: 37.5rem) {
242+
.fr-table table {
243+
display: table;
244+
table-layout: fixed;
245+
}
246+
247+
@media (width < 36rem) {
243248
.fr-table table {
244-
display: table;
245-
table-layout: fixed;
249+
display: block;
246250
}
247251
}
248252
</style>

confiture-web-app/src/components/ui/CopyBlock.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ function onClose() {
9494
flex-shrink: 0;
9595
}
9696
97-
@media (max-width: 37.5rem) {
97+
@media (width < 36rem) {
9898
.copy-block {
9999
align-items: start;
100100
flex-direction: column;

0 commit comments

Comments
 (0)