Fusion : front utilisable sur téléphone et tablette
# Conflicts: # web/src/assets/i18n/en.json # web/src/assets/i18n/fr.json
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
import { Page, expect } from '@playwright/test';
|
||||
|
||||
/**
|
||||
* Ajoute un bloc Texte au builder de template (grille de blocs) et le renomme.
|
||||
*
|
||||
* Le builder n'a plus de champ « + Ajouter un champ » : un clic sur un type de
|
||||
* la palette ajoute en bas de la grille un bloc au nom par défaut (« Texte »,
|
||||
* « Texte 2 »…), qu'on renomme dans son en-tête. Le nom est validé au blur.
|
||||
*/
|
||||
export async function addTextBlock(page: Page, name: string): Promise<void> {
|
||||
const blocks = page.locator('.grid-block');
|
||||
const before = await blocks.count();
|
||||
|
||||
await page.locator('.palette-item', { hasText: /^\s*Texte\s*$/ }).click();
|
||||
await expect(blocks).toHaveCount(before + 1);
|
||||
|
||||
const nameInput = blocks.last().locator('.block-name-input');
|
||||
await nameInput.fill(name);
|
||||
await nameInput.blur();
|
||||
await expect(page.locator(`.grid-block[data-block-name="${name}"]`)).toBeVisible();
|
||||
}
|
||||
@@ -113,7 +113,10 @@ test.describe('Scene edit', () => {
|
||||
|
||||
const branchItem = branchesSection.locator('.branch-item').first();
|
||||
await branchItem.getByPlaceholder(/Ex: Si les joueurs attaquent/i).fill('Si les PJ fuient');
|
||||
await branchItem.locator('select').selectOption({ label: sibling.name });
|
||||
// Une branche a 2 selects (scène cible + type de lien) : on vise celui qui liste la scène.
|
||||
await branchItem
|
||||
.locator('select', { has: page.locator('option', { hasText: sibling.name }) })
|
||||
.selectOption({ label: sibling.name });
|
||||
await branchItem.getByPlaceholder(/Jet de Persuasion/i).fill('Sur échec initiative');
|
||||
|
||||
await page.getByRole('button', { name: /^Sauvegarder$/i }).click();
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { test, expect } from '@playwright/test';
|
||||
import { seedLoreWithFolder, deleteLore, getTemplatesForLore, type SeededLore } from '../../fixtures/api';
|
||||
import { addTextBlock } from '../../fixtures/template-builder';
|
||||
|
||||
test.describe('Template creation', () => {
|
||||
let seeded: SeededLore;
|
||||
@@ -50,14 +51,8 @@ test.describe('Template creation', () => {
|
||||
await page.getByLabel(/Nom du template/i).fill(templateName);
|
||||
await page.getByLabel(/Dossier par défaut/i).selectOption({ label: seeded.rootFolderName });
|
||||
|
||||
const addFieldInput = page.getByPlaceholder('+ Ajouter un champ');
|
||||
await addFieldInput.fill('Pouvoir');
|
||||
await addFieldInput.press('Enter');
|
||||
await expect(page.locator('.grid-block[data-block-name="Pouvoir"]')).toBeVisible();
|
||||
|
||||
await addFieldInput.fill('Origine');
|
||||
await addFieldInput.press('Enter');
|
||||
await expect(page.locator('.grid-block[data-block-name="Origine"]')).toBeVisible();
|
||||
await addTextBlock(page, 'Pouvoir');
|
||||
await addTextBlock(page, 'Origine');
|
||||
|
||||
const origineBlock = page.locator('.grid-block[data-block-name="Origine"]');
|
||||
await origineBlock.getByRole('button', { name: 'Supprimer' }).click();
|
||||
|
||||
@@ -7,6 +7,7 @@ import {
|
||||
type SeededLore,
|
||||
type SeededTemplate,
|
||||
} from '../../fixtures/api';
|
||||
import { addTextBlock } from '../../fixtures/template-builder';
|
||||
|
||||
test.describe('Template edit', () => {
|
||||
let seeded: SeededLore;
|
||||
@@ -55,10 +56,9 @@ test.describe('Template edit', () => {
|
||||
test('adds a new field, removes an existing one, and persists the order', async ({ page, request }) => {
|
||||
await page.goto(`/lore/${seeded.id}/templates/${template.id}`);
|
||||
|
||||
const addInput = page.getByPlaceholder('+ Ajouter un champ');
|
||||
await addInput.fill('Stats');
|
||||
await addInput.press('Enter');
|
||||
await expect(page.locator('.grid-block[data-block-name="Stats"]')).toBeVisible();
|
||||
// Attendre les champs existants (chargés en asynchrone) avant d'en ajouter un.
|
||||
await expect(page.locator('.grid-block[data-block-name="Description"]')).toBeVisible();
|
||||
await addTextBlock(page, 'Stats');
|
||||
|
||||
const descriptionBlock = page.locator('.grid-block[data-block-name="Description"]');
|
||||
await descriptionBlock.getByRole('button', { name: 'Supprimer' }).click();
|
||||
|
||||
@@ -0,0 +1,164 @@
|
||||
import { test, expect, type APIRequestContext, type Page } from '@playwright/test';
|
||||
import {
|
||||
seedCampaign,
|
||||
seedArc,
|
||||
seedChapter,
|
||||
seedScene,
|
||||
deleteCampaign,
|
||||
type SeededCampaign,
|
||||
type SeededArc,
|
||||
type SeededChapter,
|
||||
type SeededScene,
|
||||
} from '../../fixtures/api';
|
||||
|
||||
/**
|
||||
* Shell responsive au viewport téléphone (projet Playwright « mobile », 375 px).
|
||||
*
|
||||
* Sous 1024 px, le menu principal et l'arborescence deviennent des tiroirs
|
||||
* off-canvas ouverts depuis une barre haute. On vérifie :
|
||||
* - qu'aucun écran clé ne défile horizontalement — ni le document, ni
|
||||
* `main.main-content` (le conteneur qui défile réellement : un débordement
|
||||
* y produirait une barre horizontale sans toucher au document) ;
|
||||
* - que la navigation reste accessible au doigt (ouverture, navigation,
|
||||
* fermeture au changement de route / Échap / clic extérieur).
|
||||
*/
|
||||
|
||||
async function expectNoHorizontalScroll(page: Page): Promise<void> {
|
||||
const m = await page.evaluate(() => {
|
||||
const main = document.querySelector('main.main-content');
|
||||
return {
|
||||
doc: document.documentElement.scrollWidth,
|
||||
vw: window.innerWidth,
|
||||
mainScroll: main?.scrollWidth ?? 0,
|
||||
mainClient: main?.clientWidth ?? 0,
|
||||
};
|
||||
});
|
||||
expect(m.doc, 'scroll horizontal du document').toBeLessThanOrEqual(m.vw);
|
||||
expect(m.mainScroll, 'scroll horizontal de main.main-content').toBeLessThanOrEqual(m.mainClient);
|
||||
}
|
||||
|
||||
async function seedPlaythroughWithSession(
|
||||
request: APIRequestContext,
|
||||
campaignId: string,
|
||||
): Promise<{ playthroughId: string; sessionId: string }> {
|
||||
const ptRes = await request.post('/api/playthroughs', {
|
||||
data: { campaignId, name: `E2E Partie ${Date.now()}`, description: 'Seeded by Playwright' },
|
||||
});
|
||||
expect(ptRes.ok(), `POST /api/playthroughs -> ${ptRes.status()}`).toBeTruthy();
|
||||
const pt = await ptRes.json();
|
||||
|
||||
const clockRes = await request.post(`/api/playthroughs/${pt.id}/clocks`, {
|
||||
data: { name: 'Le rituel du nécromancien', description: '', segments: 6 },
|
||||
});
|
||||
expect(clockRes.ok(), `POST clocks -> ${clockRes.status()}`).toBeTruthy();
|
||||
|
||||
const sRes = await request.post('/api/sessions', { data: { playthroughId: pt.id } });
|
||||
expect(sRes.ok(), `POST /api/sessions -> ${sRes.status()}`).toBeTruthy();
|
||||
const session = await sRes.json();
|
||||
|
||||
const eRes = await request.post(`/api/sessions/${session.id}/entries`, {
|
||||
data: { type: 'NOTE', content: 'Les PJ arrivent à Brumecombe sous la pluie.', occurredAt: null },
|
||||
});
|
||||
expect(eRes.ok(), `POST entries -> ${eRes.status()}`).toBeTruthy();
|
||||
|
||||
return { playthroughId: pt.id, sessionId: session.id };
|
||||
}
|
||||
|
||||
test.describe('Shell mobile (375 px)', () => {
|
||||
test('liste des campagnes : pas de scroll horizontal, menu en tiroir', async ({ page }) => {
|
||||
await page.goto('/campaigns');
|
||||
await expect(page.getByRole('heading', { name: /Vos Campagnes/i })).toBeVisible();
|
||||
await expectNoHorizontalScroll(page);
|
||||
|
||||
// Le menu principal est hors écran tant que le tiroir est fermé.
|
||||
const menu = page.locator('app-sidebar');
|
||||
await expect(menu).toBeHidden();
|
||||
|
||||
// Le libellé du burger alterne Ouvrir / Fermer : on le cible par aria-controls.
|
||||
const burger = page.locator('button[aria-controls="app-main-nav"]');
|
||||
await expect(burger).toHaveAccessibleName('Ouvrir le menu');
|
||||
await burger.tap();
|
||||
await expect(menu).toBeVisible();
|
||||
await expect(burger).toHaveAttribute('aria-expanded', 'true');
|
||||
await expect(burger).toHaveAccessibleName('Fermer le menu');
|
||||
|
||||
// Échap referme et rend le focus au bouton burger.
|
||||
await page.keyboard.press('Escape');
|
||||
await expect(menu).toBeHidden();
|
||||
await expect(burger).toBeFocused();
|
||||
|
||||
// Clic hors du tiroir (voile) : referme aussi.
|
||||
await burger.tap();
|
||||
await expect(menu).toBeVisible();
|
||||
await page.mouse.click(360, 400);
|
||||
await expect(menu).toBeHidden();
|
||||
|
||||
// Navigation depuis le tiroir : la page change et le tiroir se ferme.
|
||||
await burger.tap();
|
||||
await menu.getByRole('button', { name: 'Lore', exact: true }).tap();
|
||||
await expect(page).toHaveURL(/\/lore$/);
|
||||
await expect(page.getByRole('heading', { name: /Vos Univers/i })).toBeVisible();
|
||||
await expect(menu).toBeHidden();
|
||||
await expectNoHorizontalScroll(page);
|
||||
});
|
||||
|
||||
test.describe('avec une campagne', () => {
|
||||
let campaign: SeededCampaign;
|
||||
let arc: SeededArc;
|
||||
let chapter: SeededChapter;
|
||||
let scene: SeededScene;
|
||||
|
||||
test.beforeEach(async ({ request }) => {
|
||||
// Nom long volontaire : c'est lui qui faisait déborder l'en-tête du hub.
|
||||
campaign = await seedCampaign(request, {
|
||||
name: `E2E La Chute de la Maison Valcourt — campagne longue ${Date.now()}`,
|
||||
});
|
||||
arc = await seedArc(request, { campaignId: campaign.id });
|
||||
chapter = await seedChapter(request, { arcId: arc.id });
|
||||
scene = await seedScene(request, { chapterId: chapter.id, name: 'La taverne du Corbeau Borgne' });
|
||||
});
|
||||
|
||||
test.afterEach(async ({ request }) => {
|
||||
if (campaign?.id) await deleteCampaign(request, campaign.id);
|
||||
});
|
||||
|
||||
test('hub campagne → scène via l’arborescence en tiroir', async ({ page }) => {
|
||||
await page.goto(`/campaigns/${campaign.id}`);
|
||||
await expect(page.getByRole('heading', { level: 1, name: campaign.name })).toBeVisible();
|
||||
await expectNoHorizontalScroll(page);
|
||||
|
||||
// L'arborescence s'ouvre depuis la barre haute (bouton titré par la campagne).
|
||||
const tree = page.locator('app-secondary-sidebar');
|
||||
await expect(tree).toBeHidden();
|
||||
await page.getByRole('button', { name: "Ouvrir l'arborescence" }).tap();
|
||||
await expect(tree).toBeVisible();
|
||||
|
||||
// Déplie « Scènes » puis l'arc / le chapitre jusqu'à la scène, au doigt.
|
||||
for (const label of [/Scènes/, new RegExp(arc.name), new RegExp(chapter.name)]) {
|
||||
const row = tree.locator('.tree-row', { has: page.locator('.tree-btn', { hasText: label }) }).first();
|
||||
if (await tree.getByRole('button', { name: scene.name }).isVisible()) break;
|
||||
const chevron = row.locator('.chevron-btn');
|
||||
if (await chevron.count()) await chevron.tap();
|
||||
}
|
||||
await tree.getByRole('button', { name: scene.name }).tap();
|
||||
|
||||
await expect(page).toHaveURL(new RegExp(`/scenes/${scene.id}$`));
|
||||
await expect(page.getByRole('heading', { level: 1, name: scene.name })).toBeVisible();
|
||||
await expect(tree).toBeHidden();
|
||||
await expectNoHorizontalScroll(page);
|
||||
});
|
||||
|
||||
test('écran de séance : journal et horloges lisibles sans scroll horizontal', async ({ page, request }) => {
|
||||
const { sessionId } = await seedPlaythroughWithSession(request, campaign.id);
|
||||
|
||||
await page.goto(`/sessions/${sessionId}`);
|
||||
await expect(page.getByText('Les PJ arrivent à Brumecombe sous la pluie.')).toBeVisible();
|
||||
await expect(page.getByText('Le rituel du nécromancien')).toBeVisible();
|
||||
await expectNoHorizontalScroll(page);
|
||||
|
||||
// Le menu reste accessible depuis la séance.
|
||||
await page.getByRole('button', { name: 'Ouvrir le menu' }).tap();
|
||||
await expect(page.locator('app-sidebar')).toBeVisible();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -30,7 +30,21 @@ export default defineConfig({
|
||||
projects: [
|
||||
{
|
||||
name: 'chromium',
|
||||
testIgnore: /responsive\//,
|
||||
use: { ...devices['Desktop Chrome'] },
|
||||
},
|
||||
// Téléphone (375 px, tactile) : shell en tiroirs, absence de scroll horizontal.
|
||||
// Chromium « Desktop Chrome » redimensionné plutôt qu'un preset d'appareil :
|
||||
// même navigateur que la CI (seul chromium y est installé), largeur exacte.
|
||||
{
|
||||
name: 'mobile',
|
||||
testMatch: /responsive\/.*\.spec\.ts/,
|
||||
use: {
|
||||
...devices['Desktop Chrome'],
|
||||
viewport: { width: 375, height: 812 },
|
||||
isMobile: true,
|
||||
hasTouch: true,
|
||||
},
|
||||
},
|
||||
],
|
||||
});
|
||||
|
||||
@@ -1,10 +1,50 @@
|
||||
<app-update-banner></app-update-banner>
|
||||
|
||||
<div class="app-container">
|
||||
<app-sidebar></app-sidebar>
|
||||
<!-- Barre haute (< 1024 px) : ouvre les tiroirs menu / arborescence. Masquée en CSS sur desktop. -->
|
||||
<header class="mobile-topbar">
|
||||
<button #mainToggle type="button" class="topbar-btn"
|
||||
aria-controls="app-main-nav"
|
||||
[attr.aria-expanded]="openDrawer() === 'main'"
|
||||
[attr.aria-label]="(openDrawer() === 'main' ? 'mobileShell.closeMenu' : 'mobileShell.openMenu') | translate"
|
||||
(click)="toggleDrawer('main')">
|
||||
<lucide-icon [img]="openDrawer() === 'main' ? X : Menu" [size]="20"></lucide-icon>
|
||||
</button>
|
||||
@if (sidebarConfig$ | async; as config) {
|
||||
<button #treeToggle type="button" class="topbar-btn topbar-tree"
|
||||
aria-controls="app-tree-nav"
|
||||
[attr.aria-expanded]="openDrawer() === 'tree'"
|
||||
[attr.aria-label]="(openDrawer() === 'tree' ? 'mobileShell.closeTree' : 'mobileShell.openTree') | translate"
|
||||
(click)="toggleDrawer('tree')">
|
||||
<lucide-icon [img]="PanelLeft" [size]="18"></lucide-icon>
|
||||
<span class="topbar-title">{{ config.title }}</span>
|
||||
</button>
|
||||
} @else {
|
||||
<span class="topbar-brand">
|
||||
<img src="assets/logo.png" alt="" />
|
||||
<span>DM Loremind</span>
|
||||
</span>
|
||||
}
|
||||
<button type="button" class="topbar-btn topbar-search"
|
||||
[attr.aria-label]="'mobileShell.search' | translate"
|
||||
(click)="openSearch()">
|
||||
<lucide-icon [img]="Search" [size]="18"></lucide-icon>
|
||||
</button>
|
||||
</header>
|
||||
|
||||
<app-sidebar id="app-main-nav"
|
||||
[class.drawer-open]="openDrawer() === 'main'"
|
||||
[attr.role]="isCompact() ? 'dialog' : null"
|
||||
[attr.aria-modal]="isCompact() && openDrawer() === 'main' ? 'true' : null"
|
||||
[attr.aria-label]="'mobileShell.mainNav' | translate"></app-sidebar>
|
||||
|
||||
@if (sidebarConfig$ | async; as config) {
|
||||
<app-secondary-sidebar
|
||||
<app-secondary-sidebar id="app-tree-nav"
|
||||
[class.drawer-open]="openDrawer() === 'tree'"
|
||||
[attr.role]="isCompact() ? 'dialog' : null"
|
||||
[attr.aria-modal]="isCompact() && openDrawer() === 'tree' ? 'true' : null"
|
||||
[attr.aria-label]="'mobileShell.treeNav' | translate"
|
||||
[drawerMode]="isCompact()"
|
||||
[title]="config.title"
|
||||
[titleRoute]="config.titleRoute || null"
|
||||
[items]="config.items"
|
||||
@@ -16,7 +56,11 @@
|
||||
</app-secondary-sidebar>
|
||||
}
|
||||
|
||||
<main class="main-content">
|
||||
@if (openDrawer()) {
|
||||
<div class="drawer-backdrop" aria-hidden="true" (click)="closeDrawer()"></div>
|
||||
}
|
||||
|
||||
<main #mainContent class="main-content" tabindex="-1">
|
||||
<router-outlet></router-outlet>
|
||||
</main>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,144 @@
|
||||
// Points de rupture du shell (cf. styles/_responsive.scss) :
|
||||
// - >= 1024 px : colonnes fixes (menu + arborescence + contenu) ;
|
||||
// - < 1024 px : barre haute + menu et arborescence en tiroirs off-canvas ;
|
||||
// - < 768 px : une seule colonne, marges réduites.
|
||||
$compact: 1023.98px;
|
||||
$phone: 767.98px;
|
||||
$topbar-height: 52px;
|
||||
|
||||
.app-container {
|
||||
display: flex;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1;
|
||||
// min-width: 0 — sans ça un contenu large (tableau, graphe) élargit la colonne
|
||||
// flex au lieu de défiler dedans, et toute la page déborde horizontalement.
|
||||
min-width: 0;
|
||||
// padding-top: 0 — sinon le contenu defile dans la zone de padding
|
||||
// au-dessus du `.page-header` sticky (top: 0 pin sur l'edge interne du
|
||||
// padding-box). Chaque page-wrapper definit deja son propre padding-top
|
||||
// qui devient l'unique source d'espacement haut.
|
||||
padding: 0 2rem 2rem;
|
||||
overflow-y: auto;
|
||||
|
||||
// Focus programmatique après navigation depuis un tiroir : pas d'anneau visible.
|
||||
&:focus { outline: none; }
|
||||
}
|
||||
|
||||
.mobile-topbar,
|
||||
.drawer-backdrop { display: none; }
|
||||
|
||||
@media (max-width: $compact) {
|
||||
.app-container { flex-direction: column; }
|
||||
|
||||
.mobile-topbar {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.25rem;
|
||||
flex: 0 0 auto;
|
||||
height: $topbar-height;
|
||||
padding: 0 0.5rem;
|
||||
background: #0f0f1a;
|
||||
border-bottom: 1px solid #1e1e3a;
|
||||
position: relative;
|
||||
z-index: 120;
|
||||
}
|
||||
|
||||
.topbar-btn {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 44px;
|
||||
height: 44px;
|
||||
padding: 0 0.6rem;
|
||||
background: transparent;
|
||||
border: none;
|
||||
border-radius: 8px;
|
||||
color: #d1d5db;
|
||||
cursor: pointer;
|
||||
|
||||
&:hover, &[aria-expanded='true'] { background: #1f2937; color: white; }
|
||||
&:focus-visible { outline: 2px solid #6c63ff; outline-offset: -2px; }
|
||||
}
|
||||
|
||||
// Le bouton arborescence porte le titre de la section (campagne, lore) et prend
|
||||
// toute la place disponible : c'est la cible la plus utilisée au doigt.
|
||||
.topbar-tree {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
justify-content: flex-start;
|
||||
font-size: 0.95rem;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.topbar-title {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.topbar-brand {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
min-width: 0;
|
||||
padding-left: 0.25rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
|
||||
img { width: 1.5rem; height: 1.5rem; border-radius: 5px; }
|
||||
}
|
||||
|
||||
// Les deux sidebars deviennent des tiroirs : hors flux, cachés à gauche.
|
||||
// visibility: hidden (retardée le temps de l'animation) les sort aussi de
|
||||
// l'ordre de tabulation quand ils sont fermés.
|
||||
app-sidebar,
|
||||
app-secondary-sidebar {
|
||||
position: fixed;
|
||||
top: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
z-index: 150;
|
||||
max-width: 88vw;
|
||||
transform: translateX(-100%);
|
||||
visibility: hidden;
|
||||
transition: transform 0.25s ease, visibility 0s linear 0.25s;
|
||||
box-shadow: 4px 0 24px rgba(0, 0, 0, 0.5);
|
||||
|
||||
&.drawer-open {
|
||||
transform: none;
|
||||
visibility: visible;
|
||||
transition: transform 0.25s ease;
|
||||
}
|
||||
}
|
||||
|
||||
.drawer-backdrop {
|
||||
display: block;
|
||||
position: fixed;
|
||||
inset: 0;
|
||||
z-index: 149;
|
||||
background: rgba(0, 0, 0, 0.55);
|
||||
}
|
||||
|
||||
.main-content {
|
||||
flex: 1 1 auto;
|
||||
min-height: 0;
|
||||
padding: 0 1.25rem 1.5rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (max-width: $phone) {
|
||||
.main-content { padding: 0 0.75rem 1.25rem; }
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: reduce) {
|
||||
app-sidebar,
|
||||
app-secondary-sidebar,
|
||||
app-sidebar.drawer-open,
|
||||
app-secondary-sidebar.drawer-open { transition: none; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,11 @@
|
||||
import { Component, HostListener } from '@angular/core';
|
||||
import { Component, ElementRef, HostListener, effect, inject, signal, viewChild } from '@angular/core';
|
||||
import { AsyncPipe } from '@angular/common';
|
||||
import { RouterOutlet } from '@angular/router';
|
||||
import { takeUntilDestroyed, toSignal } from '@angular/core/rxjs-interop';
|
||||
import { BreakpointObserver } from '@angular/cdk/layout';
|
||||
import { NavigationEnd, NavigationSkipped, Router, RouterOutlet } from '@angular/router';
|
||||
import { TranslatePipe } from '@ngx-translate/core';
|
||||
import { LucideAngularModule, Menu, PanelLeft, Search, X } from 'lucide-angular';
|
||||
import { filter, map } from 'rxjs';
|
||||
import { SidebarComponent } from './sidebar/sidebar.component';
|
||||
import { SecondarySidebarComponent } from './shared/secondary-sidebar/secondary-sidebar.component';
|
||||
import { GlobalSearchComponent } from './shared/global-search/global-search.component';
|
||||
@@ -11,10 +16,20 @@ import { LayoutService } from './services/layout.service';
|
||||
import { GlobalSearchService } from './services/global-search.service';
|
||||
import { VersionCheckerService } from './services/version-checker.service';
|
||||
|
||||
/** Sous cette largeur, les deux sidebars deviennent des tiroirs off-canvas (tablette, téléphone). */
|
||||
const COMPACT_QUERY = '(max-width: 1023.98px)';
|
||||
|
||||
/** Tiroir ouvert en mode compact : menu principal, arborescence secondaire, ou aucun. */
|
||||
type ShellDrawer = 'main' | 'tree' | null;
|
||||
|
||||
const FOCUSABLE = 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
||||
|
||||
@Component({
|
||||
selector: 'app-root',
|
||||
imports: [
|
||||
RouterOutlet,
|
||||
LucideAngularModule,
|
||||
TranslatePipe,
|
||||
SidebarComponent,
|
||||
SecondarySidebarComponent,
|
||||
GlobalSearchComponent,
|
||||
@@ -29,6 +44,29 @@ import { VersionCheckerService } from './services/version-checker.service';
|
||||
export class AppComponent {
|
||||
readonly sidebarConfig$ = this.layoutService.secondarySidebar$;
|
||||
|
||||
readonly Menu = Menu;
|
||||
readonly PanelLeft = PanelLeft;
|
||||
readonly Search = Search;
|
||||
readonly X = X;
|
||||
|
||||
private readonly breakpoints = inject(BreakpointObserver);
|
||||
private readonly router = inject(Router);
|
||||
|
||||
/** True sous 1024 px : barre haute + tiroirs au lieu des colonnes fixes. */
|
||||
readonly isCompact = toSignal(
|
||||
this.breakpoints.observe(COMPACT_QUERY).pipe(map(state => state.matches)),
|
||||
{ initialValue: this.breakpoints.isMatched(COMPACT_QUERY) }
|
||||
);
|
||||
|
||||
/** Tiroir ouvert (mode compact uniquement). */
|
||||
readonly openDrawer = signal<ShellDrawer>(null);
|
||||
|
||||
private readonly mainDrawerRef = viewChild(SidebarComponent, { read: ElementRef });
|
||||
private readonly treeDrawerRef = viewChild(SecondarySidebarComponent, { read: ElementRef });
|
||||
private readonly mainToggleRef = viewChild<ElementRef<HTMLButtonElement>>('mainToggle');
|
||||
private readonly treeToggleRef = viewChild<ElementRef<HTMLButtonElement>>('treeToggle');
|
||||
private readonly mainContentRef = viewChild<ElementRef<HTMLElement>>('mainContent');
|
||||
|
||||
constructor(
|
||||
private layoutService: LayoutService,
|
||||
private globalSearch: GlobalSearchService,
|
||||
@@ -38,6 +76,48 @@ export class AppComponent {
|
||||
// Si une nouvelle version est deployee pendant la session, l'UpdateBanner
|
||||
// s'affichera automatiquement.
|
||||
versionChecker.start();
|
||||
|
||||
// Retour en largeur desktop : les tiroirs n'ont plus de sens, on les referme.
|
||||
effect(() => {
|
||||
if (!this.isCompact()) this.openDrawer.set(null);
|
||||
});
|
||||
|
||||
// Une navigation (y compris vers l'URL courante, NavigationSkipped) referme le
|
||||
// tiroir : on choisit une page, on veut la voir. Le focus part sur le contenu.
|
||||
this.router.events.pipe(
|
||||
filter(e => e instanceof NavigationEnd || e instanceof NavigationSkipped),
|
||||
takeUntilDestroyed(),
|
||||
).subscribe(() => {
|
||||
if (!this.openDrawer()) return;
|
||||
this.openDrawer.set(null);
|
||||
this.mainContentRef()?.nativeElement.focus({ preventScroll: true });
|
||||
});
|
||||
|
||||
// La recherche globale passe au-dessus : inutile de laisser le tiroir ouvert dessous.
|
||||
this.globalSearch.open$.pipe(filter(Boolean), takeUntilDestroyed()).subscribe(() => this.openDrawer.set(null));
|
||||
}
|
||||
|
||||
toggleDrawer(drawer: Exclude<ShellDrawer, null>): void {
|
||||
if (this.openDrawer() === drawer) {
|
||||
this.closeDrawer();
|
||||
return;
|
||||
}
|
||||
this.openDrawer.set(drawer);
|
||||
// Focus sur le premier élément du tiroir une fois rendu visible.
|
||||
setTimeout(() => this.focusables(this.drawerElement())[0]?.focus());
|
||||
}
|
||||
|
||||
/** Ferme le tiroir et rend le focus au bouton de la barre haute qui l'a ouvert. */
|
||||
closeDrawer(): void {
|
||||
const drawer = this.openDrawer();
|
||||
if (!drawer) return;
|
||||
this.openDrawer.set(null);
|
||||
const toggle = drawer === 'main' ? this.mainToggleRef() : this.treeToggleRef();
|
||||
toggle?.nativeElement.focus();
|
||||
}
|
||||
|
||||
openSearch(): void {
|
||||
this.globalSearch.open();
|
||||
}
|
||||
|
||||
@HostListener('document:keydown', ['$event'])
|
||||
@@ -46,6 +126,45 @@ export class AppComponent {
|
||||
if ((event.ctrlKey || event.metaKey) && event.key.toLowerCase() === 'k') {
|
||||
event.preventDefault();
|
||||
this.globalSearch.toggle();
|
||||
return;
|
||||
}
|
||||
if (!this.openDrawer()) return;
|
||||
if (event.key === 'Escape') {
|
||||
event.preventDefault();
|
||||
this.closeDrawer();
|
||||
} else if (event.key === 'Tab') {
|
||||
this.trapFocus(event);
|
||||
}
|
||||
}
|
||||
|
||||
/** Garde le focus clavier dans le tiroir ouvert (comportement de modale). */
|
||||
private trapFocus(event: KeyboardEvent): void {
|
||||
const drawer = this.drawerElement();
|
||||
const items = this.focusables(drawer);
|
||||
if (!drawer || !items.length) return;
|
||||
const first = items[0];
|
||||
const last = items[items.length - 1];
|
||||
const active = document.activeElement as HTMLElement | null;
|
||||
const inside = !!active && drawer.contains(active);
|
||||
if (event.shiftKey && (active === first || !inside)) {
|
||||
event.preventDefault();
|
||||
last.focus();
|
||||
} else if (!event.shiftKey && (active === last || !inside)) {
|
||||
event.preventDefault();
|
||||
first.focus();
|
||||
}
|
||||
}
|
||||
|
||||
private drawerElement(): HTMLElement | null {
|
||||
const drawer = this.openDrawer();
|
||||
if (drawer === 'main') return this.mainDrawerRef()?.nativeElement ?? null;
|
||||
if (drawer === 'tree') return this.treeDrawerRef()?.nativeElement ?? null;
|
||||
return null;
|
||||
}
|
||||
|
||||
private focusables(root: HTMLElement | null): HTMLElement[] {
|
||||
if (!root) return [];
|
||||
return Array.from(root.querySelectorAll<HTMLElement>(FOCUSABLE))
|
||||
.filter(el => el.offsetParent !== null || el.getClientRects().length > 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,16 +173,28 @@
|
||||
border-bottom: 1px solid #1f2937;
|
||||
margin-bottom: 1.5rem;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
gap: 1rem 1.5rem;
|
||||
|
||||
.header-texts { flex: 1; min-width: 0; }
|
||||
// Le bloc titre réclame ~280 px ; s'il ne les a pas à côté des actions
|
||||
// (tablette, desktop étroit), les actions passent dessous et s'y répartissent.
|
||||
.header-texts { flex: 1 1 280px; min-width: 0; }
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// Téléphone : l'en-tête (titre + 5 actions) mangerait la moitié de l'écran
|
||||
// s'il restait collé en haut pendant le défilement.
|
||||
@media (max-width: 767.98px) {
|
||||
position: static;
|
||||
|
||||
h1 { overflow-wrap: anywhere; }
|
||||
}
|
||||
|
||||
// Variante mode édition : champs empilés verticalement.
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
text-align: center;
|
||||
margin-bottom: 3rem;
|
||||
|
||||
@media (max-width: 767.98px) { margin-bottom: 1.5rem; }
|
||||
|
||||
.hero-icon { display: block; margin-bottom: 1rem; color: #6c63ff; }
|
||||
|
||||
h1 { font-size: 2rem; font-weight: 700; color: white; margin-bottom: 0.5rem; }
|
||||
@@ -19,7 +21,9 @@
|
||||
|
||||
.campaigns-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
// 3 colonnes sur desktop (max-width 900px), moins dès que la carte passerait
|
||||
// sous 240 px : 2 sur tablette portrait, 1 sur téléphone.
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
|
||||
@@ -308,3 +308,10 @@
|
||||
color: #9ca3af;
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
// Écrans sans survol (tactile) : poignées de liaison et de renommage visibles
|
||||
// en permanence (elles n'apparaissaient qu'au survol du nœud).
|
||||
@media (hover: none) {
|
||||
.node .node-connect { opacity: 0.9; }
|
||||
.node .node-rename { opacity: 1; }
|
||||
}
|
||||
|
||||
+8
-1
@@ -12,7 +12,14 @@
|
||||
h1 { margin: 0 0 0.2rem; font-size: 1.6rem; }
|
||||
}
|
||||
|
||||
.header-info { flex: 1; }
|
||||
.header-info { flex: 1; min-width: 0; }
|
||||
|
||||
// Téléphone : Retour et Supprimer sur la 1re ligne, titre + description en
|
||||
// pleine largeur dessous (sinon le titre tombe à un mot par ligne).
|
||||
@media (max-width: 767.98px) {
|
||||
.page-header .header-actions { margin-left: auto; flex: 0 0 auto; }
|
||||
.header-info { order: 1; flex-basis: 100%; }
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
margin: 0;
|
||||
|
||||
@@ -287,3 +287,8 @@
|
||||
}
|
||||
.canvas { width: 100%; }
|
||||
}
|
||||
|
||||
// Écrans sans survol (tactile) : poignée de redimensionnement pleinement visible.
|
||||
@media (hover: none) {
|
||||
.rh-se::after { opacity: 1; }
|
||||
}
|
||||
|
||||
@@ -46,11 +46,16 @@
|
||||
padding: 1rem 0;
|
||||
border-bottom: 1px solid #1f2937;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
gap: 1rem 1.5rem;
|
||||
|
||||
.header-texts { flex: 1; min-width: 0; }
|
||||
// Téléphone : titre + actions empilés prendraient trop de hauteur en sticky.
|
||||
@media (max-width: 767.98px) { position: static; }
|
||||
|
||||
// ~280 px réservés au titre : sinon les actions passent dessous.
|
||||
.header-texts { flex: 1 1 280px; min-width: 0; }
|
||||
|
||||
h1 {
|
||||
display: inline-flex;
|
||||
@@ -60,6 +65,7 @@
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin-bottom: 0.5rem;
|
||||
overflow-wrap: anywhere;
|
||||
|
||||
.title-icon { color: #6c63ff; }
|
||||
}
|
||||
@@ -71,8 +77,9 @@
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -24,18 +24,24 @@
|
||||
padding: 1rem 0;
|
||||
border-bottom: 1px solid #1f2937;
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
align-items: flex-start;
|
||||
justify-content: space-between;
|
||||
gap: 1.5rem;
|
||||
gap: 1rem 1.5rem;
|
||||
|
||||
// Téléphone : titre + actions empilés prendraient trop de hauteur en sticky.
|
||||
@media (max-width: 767.98px) { position: static; }
|
||||
margin-bottom: 1.5rem;
|
||||
|
||||
.header-texts { flex: 1; min-width: 0; }
|
||||
// ~280 px réservés au titre : sinon les actions passent dessous.
|
||||
.header-texts { flex: 1 1 280px; min-width: 0; }
|
||||
|
||||
h1 {
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
margin-bottom: 0.5rem;
|
||||
overflow-wrap: anywhere;
|
||||
}
|
||||
|
||||
.description {
|
||||
@@ -46,8 +52,9 @@
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// Variante mode édition : input / textarea en colonne.
|
||||
|
||||
@@ -10,6 +10,8 @@
|
||||
text-align: center;
|
||||
margin-bottom: 3rem;
|
||||
|
||||
@media (max-width: 767.98px) { margin-bottom: 1.5rem; }
|
||||
|
||||
.hero-icon { display: block; margin-bottom: 1rem; color: #6c63ff; }
|
||||
|
||||
h1 { font-size: 2rem; font-weight: 700; color: white; margin-bottom: 0.5rem; }
|
||||
@@ -19,7 +21,9 @@
|
||||
|
||||
.lore-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(3, 1fr);
|
||||
// 3 colonnes sur desktop (max-width 900px), moins dès que la carte passerait
|
||||
// sous 240 px : 2 sur tablette portrait, 1 sur téléphone.
|
||||
grid-template-columns: repeat(auto-fill, minmax(min(240px, 100%), 1fr));
|
||||
gap: 1.5rem;
|
||||
width: 100%;
|
||||
max-width: 900px;
|
||||
|
||||
@@ -64,12 +64,14 @@
|
||||
gap: 1.5rem;
|
||||
flex-wrap: wrap;
|
||||
|
||||
.header-texts { flex: 1; min-width: 0; }
|
||||
// ~280 px réservés au titre : sinon les actions passent dessous (téléphone).
|
||||
.header-texts { flex: 1 1 280px; min-width: 0; }
|
||||
|
||||
h1 {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
gap: 0.5rem;
|
||||
overflow-wrap: anywhere;
|
||||
font-size: 1.75rem;
|
||||
font-weight: 700;
|
||||
color: white;
|
||||
@@ -90,7 +92,8 @@
|
||||
font-weight: 700;
|
||||
padding: 0.4rem 0.75rem;
|
||||
border-radius: 6px;
|
||||
min-width: 280px;
|
||||
min-width: min(280px, 100%);
|
||||
flex: 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,8 +122,9 @@
|
||||
|
||||
.header-actions {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
flex-shrink: 0;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
// ─────────────── Boutons ───────────────
|
||||
@@ -176,6 +180,9 @@
|
||||
border: 1px solid #1f2937;
|
||||
border-radius: 12px;
|
||||
padding: 1.5rem 1.75rem;
|
||||
|
||||
// Téléphone : la carte garde sa bordure mais rend la place au contenu.
|
||||
@media (max-width: 767.98px) { padding: 1rem 0.85rem; }
|
||||
}
|
||||
|
||||
.timeline-section h2 {
|
||||
|
||||
@@ -300,8 +300,11 @@
|
||||
font-size: 0.9rem;
|
||||
font-weight: 500;
|
||||
|
||||
flex-wrap: wrap;
|
||||
|
||||
select {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
max-width: 340px;
|
||||
padding: 8px 10px;
|
||||
border-radius: 8px;
|
||||
|
||||
@@ -564,3 +564,27 @@
|
||||
color: #f87171;
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
// Écrans sans survol (tactile) : la corbeille d'une conversation reste visible.
|
||||
@media (hover: none) {
|
||||
.conv-item .conv-item-del { opacity: 1; }
|
||||
}
|
||||
|
||||
// Téléphone / petite tablette : le drawer ne dépasse jamais l'écran (la largeur
|
||||
// inline mémorisée sur desktop est plafonnée), et la liste des conversations
|
||||
// passe au-dessus du fil au lieu de lui prendre 220 px de large.
|
||||
@media (max-width: 767.98px) {
|
||||
.drawer {
|
||||
max-width: 100vw;
|
||||
height: 100dvh;
|
||||
flex-direction: column;
|
||||
}
|
||||
.resize-handle { display: none; }
|
||||
.conv-sidebar {
|
||||
width: 100%;
|
||||
max-height: 35%;
|
||||
border-right: none;
|
||||
border-bottom: 1px solid #1e1e3a;
|
||||
}
|
||||
.conv-main { min-height: 0; flex: 1; }
|
||||
}
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
|
||||
.front-create {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 0.5rem;
|
||||
align-items: center;
|
||||
margin-bottom: 0.75rem;
|
||||
@@ -173,3 +174,19 @@
|
||||
input[type="text"] { flex: 1; min-width: 160px; }
|
||||
select { min-width: 120px; }
|
||||
}
|
||||
|
||||
// Écrans tactiles : grille de 2 cartes minimum au téléphone, boutons −/+ de
|
||||
// 30 px visables au doigt — c'est l'action la plus fréquente en pleine séance.
|
||||
@media (pointer: coarse) {
|
||||
.clock-grid {
|
||||
display: grid;
|
||||
grid-template-columns: repeat(auto-fill, minmax(136px, 1fr));
|
||||
gap: 0.75rem;
|
||||
}
|
||||
.clock-card { width: auto; padding: 0.5rem 0.4rem; }
|
||||
.clock-card .clock-actions {
|
||||
gap: 0.2rem;
|
||||
|
||||
button { width: 30px; height: 30px; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -185,7 +185,7 @@
|
||||
|
||||
.carousel-slide {
|
||||
flex: 0 0 auto;
|
||||
width: 360px;
|
||||
width: min(360px, 85vw);
|
||||
aspect-ratio: 16 / 9;
|
||||
height: auto;
|
||||
scroll-snap-align: start;
|
||||
@@ -440,3 +440,9 @@
|
||||
from { opacity: 0; }
|
||||
to { opacity: 1; }
|
||||
}
|
||||
|
||||
// Écrans sans survol (tactile) : le bouton de retrait est toujours visible, et
|
||||
// plus gros pour être visé au doigt.
|
||||
@media (hover: none) {
|
||||
.gallery-remove { opacity: 1; width: 32px; height: 32px; }
|
||||
}
|
||||
|
||||
@@ -1,12 +1,18 @@
|
||||
<aside class="secondary-sidebar"
|
||||
[class.collapsed]="isCollapsed"
|
||||
[style.width.px]="isCollapsed ? null : width">
|
||||
[class.collapsed]="collapsed"
|
||||
[class.drawer]="drawerMode"
|
||||
[style.width.px]="collapsed || drawerMode ? null : width">
|
||||
|
||||
<div class="collapse-toggle" (click)="toggleCollapse()">
|
||||
<lucide-icon [img]="isCollapsed ? PanelLeftOpen : PanelLeftClose" [size]="16"></lucide-icon>
|
||||
</div>
|
||||
<!-- Repli 44 px : desktop uniquement (en tiroir, on ferme le tiroir à la place). -->
|
||||
@if (!drawerMode) {
|
||||
<button type="button" class="collapse-toggle" (click)="toggleCollapse()"
|
||||
[attr.aria-expanded]="!isCollapsed"
|
||||
[attr.aria-label]="(isCollapsed ? 'mobileShell.expandTree' : 'mobileShell.collapseTree') | translate">
|
||||
<lucide-icon [img]="isCollapsed ? PanelLeftOpen : PanelLeftClose" [size]="16"></lucide-icon>
|
||||
</button>
|
||||
}
|
||||
|
||||
@if (!isCollapsed) {
|
||||
@if (!collapsed) {
|
||||
@if (titleRoute) {
|
||||
<button
|
||||
type="button"
|
||||
@@ -103,8 +109,8 @@
|
||||
}
|
||||
}
|
||||
|
||||
<!-- Poignée de redimensionnement sur le bord droit (masquée si replié) -->
|
||||
@if (!isCollapsed) {
|
||||
<!-- Poignée de redimensionnement sur le bord droit (masquée si replié ou en tiroir) -->
|
||||
@if (!collapsed && !drawerMode) {
|
||||
<div class="resize-handle"
|
||||
(mousedown)="startResize($event)"
|
||||
[title]="'secondarySidebar.resizeHandle' | translate"></div>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.secondary-sidebar {
|
||||
width: 220px;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
background: #0d0d1f;
|
||||
border-right: 1px solid #1e1e3a;
|
||||
display: flex;
|
||||
@@ -12,6 +13,12 @@
|
||||
// Pas de transition sur la largeur : sinon le drag de resize "traîne" derrière la souris.
|
||||
// L'animation d'expand/collapse est gérée uniquement par la classe .collapsed ci-dessous.
|
||||
|
||||
// Tiroir (shell < 1024 px) : largeur confortable au doigt, plafonnée par l'écran.
|
||||
&.drawer {
|
||||
width: min(320px, 88vw);
|
||||
padding: 1rem 0.75rem;
|
||||
}
|
||||
|
||||
&.collapsed {
|
||||
width: 44px !important;
|
||||
padding: 1.25rem 0.5rem;
|
||||
@@ -41,6 +48,9 @@
|
||||
justify-content: center;
|
||||
width: 28px;
|
||||
height: 28px;
|
||||
padding: 0;
|
||||
background: none;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
color: #6b7280;
|
||||
@@ -246,3 +256,11 @@
|
||||
// NB : aperçu/placeholder = styles GLOBAUX (src/styles.scss), car l'aperçu CDK est
|
||||
// déplacé hors du composant. Ici, juste le retour visuel de la drop list RACINE.
|
||||
.tree-list.cdk-drop-list-receiving { background: rgba(138, 123, 200, 0.08); border-radius: 4px; }
|
||||
|
||||
// Écrans tactiles : cibles de 40 px minimum dans l'en-tête et le panneau bas.
|
||||
@media (pointer: coarse) {
|
||||
.sidebar-title--link { min-height: 40px; }
|
||||
.btn-pill { min-height: 40px; }
|
||||
.panel-header-action { width: 36px; height: 36px; }
|
||||
.panel-header, .panel-item { min-height: 40px; }
|
||||
}
|
||||
|
||||
@@ -25,6 +25,11 @@ export class SecondarySidebarComponent implements OnDestroy {
|
||||
@Input() rootDropKinds: ReorderKind[] | null = null;
|
||||
@Input() rootDropParentId: string | null = null;
|
||||
@Input() reorderContext: SidebarReorderContext | null = null;
|
||||
/**
|
||||
* Mode tiroir (shell < 1024 px) : largeur fixée par le CSS, pas de repli 44 px
|
||||
* ni de poignée de redimensionnement — le tiroir se ferme depuis la barre haute.
|
||||
*/
|
||||
@Input() drawerMode = false;
|
||||
@Output() collapsedChange = new EventEmitter<boolean>();
|
||||
|
||||
/** true = ouvert (on affiche les items) ; false = replié (titre seul). */
|
||||
@@ -41,6 +46,11 @@ export class SecondarySidebarComponent implements OnDestroy {
|
||||
|
||||
isCollapsed = false;
|
||||
|
||||
/** Repli effectif : le repli desktop est ignoré en mode tiroir. */
|
||||
get collapsed(): boolean {
|
||||
return this.isCollapsed && !this.drawerMode;
|
||||
}
|
||||
|
||||
// --- Resize (étirement horizontal) -------------------------------------
|
||||
/** Clé localStorage pour persister la largeur choisie par l'utilisateur. */
|
||||
private static readonly WIDTH_STORAGE_KEY = 'secondary-sidebar-width';
|
||||
|
||||
@@ -148,3 +148,22 @@
|
||||
}
|
||||
.tree-row:hover .drag-handle { opacity: 0.9; color: #8a7bc8; }
|
||||
.drag-handle:active { cursor: grabbing; }
|
||||
|
||||
// Écrans sans survol (tactile) : les actions « + » et la poignée de glisser-déposer
|
||||
// ne peuvent pas être révélées au survol → toujours visibles, cibles agrandies.
|
||||
@media (hover: none) {
|
||||
.node-actions {
|
||||
opacity: 1;
|
||||
pointer-events: auto;
|
||||
position: static;
|
||||
background: none;
|
||||
padding-left: 0;
|
||||
}
|
||||
.drag-handle { opacity: 0.7; width: 20px; }
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.tree-btn { min-height: 40px; font-size: 0.9rem; }
|
||||
.chevron-btn, .chevron-spacer { width: 28px; height: 28px; }
|
||||
.node-action-btn { width: 36px; height: 36px; }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
.sidebar {
|
||||
width: 190px;
|
||||
height: 100vh;
|
||||
height: 100dvh;
|
||||
background: #0f0f1a;
|
||||
color: #e0e0e0;
|
||||
display: flex;
|
||||
@@ -202,3 +203,24 @@
|
||||
}
|
||||
|
||||
.version { font-size: 0.7rem; color: #4b5563; }
|
||||
|
||||
// Tiroir (shell < 1024 px) : plus large, et le contenu défile si l'écran est bas
|
||||
// (téléphone en paysage) au lieu d'écraser la liste des campagnes / lores.
|
||||
@media (max-width: 1023.98px) {
|
||||
.sidebar {
|
||||
width: min(280px, 88vw);
|
||||
overflow-y: auto;
|
||||
}
|
||||
.sidebar-header { margin-bottom: 1.25rem; }
|
||||
}
|
||||
|
||||
@media (pointer: coarse) {
|
||||
.toggle-btn { min-height: 40px; }
|
||||
.context-item { min-height: 40px; font-size: 0.9rem; }
|
||||
.tool-btn { min-height: 44px; }
|
||||
}
|
||||
|
||||
// Pas de clavier physique présumé sur écran tactile : le raccourci n'a pas de sens.
|
||||
@media (hover: none) {
|
||||
.tool-kbd { display: none; }
|
||||
}
|
||||
|
||||
@@ -2433,5 +2433,16 @@
|
||||
"onHostText": "This page is for connecting a tablet. On this PC, access is managed from Settings.",
|
||||
"onHostLink": "Open access settings"
|
||||
}
|
||||
},
|
||||
"mobileShell": {
|
||||
"openMenu": "Open menu",
|
||||
"closeMenu": "Close menu",
|
||||
"openTree": "Open tree",
|
||||
"closeTree": "Close tree",
|
||||
"mainNav": "Main menu",
|
||||
"treeNav": "Tree",
|
||||
"search": "Search",
|
||||
"collapseTree": "Collapse tree",
|
||||
"expandTree": "Expand tree"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2433,5 +2433,16 @@
|
||||
"onHostText": "Cette page sert à connecter une tablette. Sur ce PC, l'accès se règle depuis les Paramètres.",
|
||||
"onHostLink": "Ouvrir les réglages d'accès"
|
||||
}
|
||||
},
|
||||
"mobileShell": {
|
||||
"openMenu": "Ouvrir le menu",
|
||||
"closeMenu": "Fermer le menu",
|
||||
"openTree": "Ouvrir l'arborescence",
|
||||
"closeTree": "Fermer l'arborescence",
|
||||
"mainNav": "Menu principal",
|
||||
"treeNav": "Arborescence",
|
||||
"search": "Rechercher",
|
||||
"collapseTree": "Replier l'arborescence",
|
||||
"expandTree": "Déplier l'arborescence"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mobileShell": {
|
||||
"openMenu": "Open menu",
|
||||
"closeMenu": "Close menu",
|
||||
"openTree": "Open tree",
|
||||
"closeTree": "Close tree",
|
||||
"mainNav": "Main menu",
|
||||
"treeNav": "Tree",
|
||||
"search": "Search",
|
||||
"collapseTree": "Collapse tree",
|
||||
"expandTree": "Expand tree"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
{
|
||||
"mobileShell": {
|
||||
"openMenu": "Ouvrir le menu",
|
||||
"closeMenu": "Fermer le menu",
|
||||
"openTree": "Ouvrir l'arborescence",
|
||||
"closeTree": "Fermer l'arborescence",
|
||||
"mainNav": "Menu principal",
|
||||
"treeNav": "Arborescence",
|
||||
"search": "Rechercher",
|
||||
"collapseTree": "Replier l'arborescence",
|
||||
"expandTree": "Déplier l'arborescence"
|
||||
}
|
||||
}
|
||||
@@ -7,6 +7,7 @@
|
||||
@use './styles/buttons';
|
||||
@use './styles/forms';
|
||||
@use './styles/view';
|
||||
@use './styles/responsive';
|
||||
|
||||
* {
|
||||
margin: 0;
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
// ==========================================================================
|
||||
// Règles responsive globales (téléphone / tablette)
|
||||
// --------------------------------------------------------------------------
|
||||
// Points de rupture partagés avec le shell (app.component.scss) :
|
||||
// < 1024 px : tablette — menu et arborescence en tiroirs ;
|
||||
// < 768 px : téléphone — une colonne, en-têtes repliés ;
|
||||
// < 600 px : formulaires sur une colonne.
|
||||
// Les règles ci-dessous ne visent que des classes GLOBALES (styles/_forms,
|
||||
// _view, _buttons). Les composants gardent leurs propres @media.
|
||||
// ==========================================================================
|
||||
|
||||
// Garde-fou : un média (image, vidéo, canvas) ne doit jamais élargir la page.
|
||||
img, video, canvas { max-width: 100%; }
|
||||
|
||||
// Pas d'agrandissement automatique du texte à la rotation (iOS / Android).
|
||||
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
|
||||
|
||||
// En-têtes (formulaires et fiches) : quand la place manque — tablette, ou desktop
|
||||
// avec deux sidebars ouvertes —, les actions passent sous le titre et se
|
||||
// répartissent sur plusieurs lignes au lieu de pousser la page hors de l'écran.
|
||||
// Seul flex-wrap est posé ici : les composants gardent leur display/gap/alignement.
|
||||
.page-header,
|
||||
.page-header .header-actions,
|
||||
.view-page .view-header {
|
||||
flex-wrap: wrap;
|
||||
}
|
||||
|
||||
.view-page .view-header .view-actions {
|
||||
flex-wrap: wrap;
|
||||
flex-shrink: 1;
|
||||
min-width: 0;
|
||||
}
|
||||
|
||||
@media (max-width: 599.98px) {
|
||||
.field-row { grid-template-columns: 1fr; }
|
||||
}
|
||||
|
||||
@media (max-width: 767.98px) {
|
||||
// Les pages posent leur propre marge latérale (souvent 2rem) en plus de celle
|
||||
// du shell : sur téléphone on ne garde que celle du shell (main-content),
|
||||
// sinon le contenu utile tombe sous 290 px. !important : les wrappers sont
|
||||
// stylés dans leurs composants (encapsulation, spécificité supérieure).
|
||||
.main-content > :not(router-outlet) > :first-child {
|
||||
padding-left: 0 !important;
|
||||
padding-right: 0 !important;
|
||||
padding-top: 1rem !important;
|
||||
}
|
||||
|
||||
// En-tête de formulaire : titre sur sa ligne, actions à la ligne en dessous.
|
||||
.page-header {
|
||||
padding: 0.75rem 0;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
h1 { font-size: 1.25rem; overflow-wrap: anywhere; }
|
||||
|
||||
// Formulaires d'édition : la barre d'actions occupe sa propre ligne.
|
||||
> .header-actions { flex: 1 1 100%; }
|
||||
}
|
||||
|
||||
// Fiches de consultation (page, arc, chapitre, scène) : marges réduites,
|
||||
// titre sur toute la largeur puis actions en dessous.
|
||||
.view-page {
|
||||
padding: 1rem 0;
|
||||
|
||||
.view-header {
|
||||
align-items: flex-start;
|
||||
padding: 0.75rem 0;
|
||||
margin-bottom: 1rem;
|
||||
|
||||
> :first-child { flex: 1 1 100%; min-width: 0; }
|
||||
|
||||
h1 { font-size: 1.35rem; overflow-wrap: anywhere; }
|
||||
}
|
||||
}
|
||||
|
||||
.form-actions { gap: 0.6rem; }
|
||||
|
||||
// Évite le zoom automatique d'iOS au focus d'un champ (déclenché sous 16 px).
|
||||
.field input,
|
||||
.field textarea,
|
||||
.field select { font-size: 16px; }
|
||||
}
|
||||
|
||||
// Écrans tactiles : les boutons partagés atteignent une cible confortable.
|
||||
@media (pointer: coarse) {
|
||||
.btn-primary,
|
||||
.btn-secondary,
|
||||
.btn-danger,
|
||||
.btn-ai,
|
||||
.btn-back { min-height: 40px; }
|
||||
}
|
||||
Reference in New Issue
Block a user