diff --git a/site/blueprints/blocks/white-paper.yml b/site/blueprints/blocks/white-paper.yml new file mode 100644 index 0000000..d899c16 --- /dev/null +++ b/site/blueprints/blocks/white-paper.yml @@ -0,0 +1,20 @@ +name: Livre blanc +icon: download + +fields: + whitePaper: + label: Livre blanc + type: pages + max: 1 + query: site.find('livres-blancs').children + image: + cover: true + ratio: 4/3 + bgColor: + label: Couleur de fond + type: color + default: "#ffffff" + textColor: + label: Couleur de texte + type: color + default: "#000000" diff --git a/site/blueprints/pages/article.yml b/site/blueprints/pages/article.yml index dd79365..641107e 100644 --- a/site/blueprints/pages/article.yml +++ b/site/blueprints/pages/article.yml @@ -72,6 +72,8 @@ tabs: extends: blocks/video jeu: extends: blocks/jeu + white-paper: + extends: blocks/white-paper # Sidebar sidebar: diff --git a/site/snippets/blocks/white-paper.php b/site/snippets/blocks/white-paper.php new file mode 100644 index 0000000..23b4eba --- /dev/null +++ b/site/snippets/blocks/white-paper.php @@ -0,0 +1,26 @@ +whitePaper()->toPage(); +if (!$wp) return; + +$cover = $wp->cover()->toFile()?->url(); +$bgColor = $block->bgColor()->isNotEmpty() ? $block->bgColor()->value() : '#ffffff'; +$textColor = $block->textColor()->isNotEmpty() ? $block->textColor()->value() : '#000000'; +$style = 'background:' . htmlspecialchars($bgColor, ENT_QUOTES, 'UTF-8') . ';color:' . htmlspecialchars($textColor, ENT_QUOTES, 'UTF-8'); +?> +
+
+

Livre blanc

+

title()) ?>

+ intro()->isNotEmpty()): ?> +

intro()->value()) ?>

+ + +
+ + <?= html($wp->title()) ?> + +
diff --git a/src/components/WhitePaperDialog.svelte b/src/components/WhitePaperDialog.svelte new file mode 100644 index 0000000..8170832 --- /dev/null +++ b/src/components/WhitePaperDialog.svelte @@ -0,0 +1,478 @@ + + + + +
+ + + {#if status === 'success'} +
+ +

{t('wp_success_heading')}

+

{t('wp_success_sub')}

+ +
+ {:else} +
+

{t('wp_form_intro')}

+ +
+
+ Identité +
+
+ + +
+
+ + +
+
+
+ +
+ + +
+ +
+ + +
+ +
+ + +
+ + + + + + + {#if status === 'error'} + + {/if} + + +
+
+ {/if} +
+
+ + diff --git a/src/views/Article.svelte b/src/views/Article.svelte index e87f3c6..42f9535 100644 --- a/src/views/Article.svelte +++ b/src/views/Article.svelte @@ -7,9 +7,12 @@ import { t } from '@i18n' import { onMount } from 'svelte' import Footer from '@components/layout/Footer.svelte' + import WhitePaperDialog from '@components/WhitePaperDialog.svelte' let { data, onBack } = $props() + let activeWhitePaperUri = $state(null) + let copySuccess = $state(false) let copyTimer = null @@ -18,6 +21,15 @@ if (!data.body) return const timer = setTimeout(() => { + // Boutons livre-blanc → ouvre la dialog + document.querySelectorAll('.wp-block__btn').forEach(btn => { + if (btn.dataset.initialized) return + btn.dataset.initialized = 'true' + btn.addEventListener('click', () => { + activeWhitePaperUri = btn.dataset.uri + }) + }) + document.querySelectorAll('.iframe-game-container').forEach(container => { if (container.dataset.initialized) return container.dataset.initialized = 'true' @@ -180,6 +192,8 @@