]> git.r.bdr.sh - rbdr/forum/commitdiff
Allow for conditional reply
authorRuben Beltran del Rio <redacted>
Mon, 12 Apr 2021 13:42:43 +0000 (15:42 +0200)
committerRuben Beltran del Rio <redacted>
Mon, 12 Apr 2021 13:42:43 +0000 (15:42 +0200)
src/components/header/header.svelte
src/components/language_selector/language_selector.svelte
src/pages/t/[topic_id].svelte [moved from src/pages/t/[id].svelte with 61% similarity]

index ed91526c4a7822a48164761e8f2dbbc394b3ec59..c68a685f6c5226397433376031c23f7afa862427 100644 (file)
@@ -1,6 +1,7 @@
 <script>
   import { _ } from 'svelte-i18n';
 
+  import { params } from '@roxi/routify';
   import { version } from '$/config/config';
 </script>
 
@@ -8,7 +9,9 @@
   <ul>
     <li><strong><a href="/" aria-label="{$_('header.long_version', { values: { version } })}">{$_('header.short_version', { values: { version } })}</a></strong></li>
     <li><a href="/new" aria-label="{$_('header.action.new.title')}">{@html $_('header.action.new.display')}</a></li>
-    <li><a href="/reply" aria-label="{$_('header.action.reply.title')}">{@html $_('header.action.reply.display')}</a></li>
+    {#if $params.topic_id}
+      <li><a href="/reply/{$params.topic_id}" aria-label="{$_('header.action.reply.title')}">{@html $_('header.action.reply.display')}</a></li>
+    {/if}
     <li><a href="/search" aria-label="{$_('header.action.search.title')}">{@html $_('header.action.search.display')}</a></li>
     <li><a href="/logout" aria-label="{$_('header.action.log_out.title')}">{@html $_('header.action.log_out.display')}</a></li>
   </ul>
index 67c08143f7021dedd8ccd915117ee649751fab28..3ac4894008088e0015d2234fbeccfc3bedae03df 100644 (file)
@@ -3,9 +3,9 @@
   import { getLangNameFromCode } from 'language-name-map';
 
   $: namedLocales = $locales
-    .map((locale) => ({
-      code: locale,
-      ...getLangNameFromCode(locale)
+    .map((code) => ({
+      code,
+      ...getLangNameFromCode(code)
     }))
     .sort((a, b) => a.native - b.native);
 
similarity index 61%
rename from src/pages/t/[id].svelte
rename to src/pages/t/[topic_id].svelte
index e13fd047f7af41b7dcd302c12eebb281df51bae0..8ead8f3c80c118500391765bd25a3b26ab00cf29 100644 (file)
@@ -1,6 +1,6 @@
 <script>
   import Topic from '$/components/topic/topic.svelte';
-  export let id;
+  export let topic_id;
 </script>
 
-<Topic id={id}/>
+<Topic id={topic_id}/>