Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

Add show more/less button for long journal entries (#623)

Maurice1a3407a218cf
diff --git a/client/src/i18n/translations/ar.ts b/client/src/i18n/translations/ar.ts
index e77b0d47e..3a37d8f58 100644
--- a/client/src/i18n/translations/ar.ts
+++ b/client/src/i18n/translations/ar.ts
@@ -5,6 +5,8 @@ const ar: Record<string, string | { name: string; category: string }[]> = {
// Common
'common.save': 'حفظ',
+ 'common.showMore': 'عرض المزيد',
+ 'common.showLess': 'عرض أقل',
'common.cancel': 'إلغاء',
'common.delete': 'حذف',
'common.edit': 'تعديل',
diff --git a/client/src/i18n/translations/br.ts b/client/src/i18n/translations/br.ts
index 448815e26..ef89acd7d 100644
--- a/client/src/i18n/translations/br.ts
+++ b/client/src/i18n/translations/br.ts
@@ -1,6 +1,8 @@
const br: Record<string, string | { name: string; category: string }[]> = {
// Common
'common.save': 'Salvar',
+ 'common.showMore': 'Mostrar mais',
+ 'common.showLess': 'Mostrar menos',
'common.cancel': 'Cancelar',
'common.delete': 'Excluir',
'common.edit': 'Editar',
diff --git a/client/src/i18n/translations/cs.ts b/client/src/i18n/translations/cs.ts
index f92503610..3a0cf3751 100644
--- a/client/src/i18n/translations/cs.ts
+++ b/client/src/i18n/translations/cs.ts
@@ -1,6 +1,8 @@
const cs: Record<string, string | { name: string; category: string }[]> = {
// Společné (Common)
'common.save': 'Uložit',
+ 'common.showMore': 'Zobrazit více',
+ 'common.showLess': 'Zobrazit méně',
'common.cancel': 'Zrušit',
'common.delete': 'Smazat',
'common.edit': 'Upravit',
diff --git a/client/src/i18n/translations/de.ts b/client/src/i18n/translations/de.ts
index 2ff656116..107b99034 100644
--- a/client/src/i18n/translations/de.ts
+++ b/client/src/i18n/translations/de.ts
@@ -1,6 +1,8 @@
const de: Record<string, string | { name: string; category: string }[]> = {
// Allgemein
'common.save': 'Speichern',
+ 'common.showMore': 'Mehr anzeigen',
+ 'common.showLess': 'Weniger anzeigen',
'common.cancel': 'Abbrechen',
'common.delete': 'Löschen',
'common.edit': 'Bearbeiten',
diff --git a/client/src/i18n/translations/en.ts b/client/src/i18n/translations/en.ts
index 886c42131..8acb22383 100644
--- a/client/src/i18n/translations/en.ts
+++ b/client/src/i18n/translations/en.ts
@@ -1,6 +1,8 @@
const en: Record<string, string | { name: string; category: string }[]> = {
// Common
'common.save': 'Save',
+ 'common.showMore': 'Show more',
+ 'common.showLess': 'Show less',
'common.cancel': 'Cancel',
'common.delete': 'Delete',
'common.edit': 'Edit',
diff --git a/client/src/i18n/translations/es.ts b/client/src/i18n/translations/es.ts
index 5f3c4b17b..518bac4e8 100644
--- a/client/src/i18n/translations/es.ts
+++ b/client/src/i18n/translations/es.ts
@@ -1,6 +1,8 @@
const es: Record<string, string> = {
// Common
'common.save': 'Guardar',
+ 'common.showMore': 'Ver más',
+ 'common.showLess': 'Ver menos',
'common.cancel': 'Cancelar',
'common.delete': 'Eliminar',
'common.edit': 'Editar',
diff --git a/client/src/i18n/translations/fr.ts b/client/src/i18n/translations/fr.ts
index 88bda0bd3..b5aaa41ab 100644
--- a/client/src/i18n/translations/fr.ts
+++ b/client/src/i18n/translations/fr.ts
@@ -1,6 +1,8 @@
const fr: Record<string, string> = {
// Common
'common.save': 'Enregistrer',
+ 'common.showMore': 'Voir plus',
+ 'common.showLess': 'Voir moins',
'common.cancel': 'Annuler',
'common.delete': 'Supprimer',
'common.edit': 'Modifier',
diff --git a/client/src/i18n/translations/hu.ts b/client/src/i18n/translations/hu.ts
index 4fdc8f310..816fe69da 100644
--- a/client/src/i18n/translations/hu.ts
+++ b/client/src/i18n/translations/hu.ts
@@ -1,6 +1,8 @@
const hu: Record<string, string | { name: string; category: string }[]> = {
// Általános
'common.save': 'Mentés',
+ 'common.showMore': 'Továbbiak',
+ 'common.showLess': 'Kevesebb',
'common.cancel': 'Mégse',
'common.delete': 'Törlés',
'common.edit': 'Szerkesztés',
diff --git a/client/src/i18n/translations/it.ts b/client/src/i18n/translations/it.ts
index a781535fb..8c7d986e8 100644
--- a/client/src/i18n/translations/it.ts
+++ b/client/src/i18n/translations/it.ts
@@ -1,6 +1,8 @@
const it: Record<string, string | { name: string; category: string }[]> = {
// Common
'common.save': 'Salva',
+ 'common.showMore': 'Mostra di più',
+ 'common.showLess': 'Mostra meno',
'common.cancel': 'Annulla',
'common.delete': 'Elimina',
'common.edit': 'Modifica',
diff --git a/client/src/i18n/translations/nl.ts b/client/src/i18n/translations/nl.ts
index a8726b42f..ab7790bcd 100644
--- a/client/src/i18n/translations/nl.ts
+++ b/client/src/i18n/translations/nl.ts
@@ -1,6 +1,8 @@
const nl: Record<string, string> = {
// Common
'common.save': 'Opslaan',
+ 'common.showMore': 'Meer tonen',
+ 'common.showLess': 'Minder tonen',
'common.cancel': 'Annuleren',
'common.delete': 'Verwijderen',
'common.edit': 'Bewerken',
diff --git a/client/src/i18n/translations/pl.ts b/client/src/i18n/translations/pl.ts
index 45c83dde2..a3a2953b8 100644
--- a/client/src/i18n/translations/pl.ts
+++ b/client/src/i18n/translations/pl.ts
@@ -1,6 +1,8 @@
const pl: Record<string, string | { name: string; category: string }[]> = {
// Common
'common.save': 'Zapisz',
+ 'common.showMore': 'Pokaż więcej',
+ 'common.showLess': 'Pokaż mniej',
'common.cancel': 'Anuluj',
'common.delete': 'Usuń',
'common.edit': 'Edytuj',
diff --git a/client/src/i18n/translations/ru.ts b/client/src/i18n/translations/ru.ts
index 8fc085650..6842f0159 100644
--- a/client/src/i18n/translations/ru.ts
+++ b/client/src/i18n/translations/ru.ts
@@ -1,6 +1,8 @@
const ru: Record<string, string> = {
// Common
'common.save': 'Сохранить',
+ 'common.showMore': 'Показать больше',
+ 'common.showLess': 'Показать меньше',
'common.cancel': 'Отмена',
'common.delete': 'Удалить',
'common.edit': 'Редактировать',
diff --git a/client/src/i18n/translations/zh.ts b/client/src/i18n/translations/zh.ts
index d998b5c08..e78e4b94a 100644
--- a/client/src/i18n/translations/zh.ts
+++ b/client/src/i18n/translations/zh.ts
@@ -1,6 +1,8 @@
const zh: Record<string, string> = {
// Common
'common.save': '保存',
+ 'common.showMore': '显示更多',
+ 'common.showLess': '收起',
'common.cancel': '取消',
'common.delete': '删除',
'common.edit': '编辑',
diff --git a/client/src/i18n/translations/zhTw.ts b/client/src/i18n/translations/zhTw.ts
index 766120342..e7393705b 100644
--- a/client/src/i18n/translations/zhTw.ts
+++ b/client/src/i18n/translations/zhTw.ts
@@ -1,6 +1,8 @@
const zhTw: Record<string, string> = {
// Common
'common.save': '儲存',
+ 'common.showMore': '顯示更多',
+ 'common.showLess': '收起',
'common.cancel': '取消',
'common.delete': '刪除',
'common.edit': '編輯',
diff --git a/client/src/pages/JourneyDetailPage.tsx b/client/src/pages/JourneyDetailPage.tsx
index ba69b1f73..d8875d195 100644
--- a/client/src/pages/JourneyDetailPage.tsx
+++ b/client/src/pages/JourneyDetailPage.tsx
@@ -992,6 +992,7 @@ function GalleryView({ entries, journeyId, userId, trips, onPhotoClick, onRefres
// ── Expandable Story ─────────────────────────────────────────────────────
function ExpandableStory({ story }: { story: string }) {
+ const { t } = useTranslation()
const [expanded, setExpanded] = useState(false)
const [clamped, setClamped] = useState(false)
const ref = useRef<HTMLDivElement>(null)
@@ -1017,16 +1018,24 @@ function ExpandableStory({ story }: { story: string }) {
onClick={() => { if (clamped || expanded) setExpanded(e => !e) }}
className={`text-[13px] text-zinc-700 dark:text-zinc-300 leading-relaxed ${
expanded ? '' : 'line-clamp-3 md:line-clamp-[9]'
- } ${clamped || expanded ? 'cursor-pointer md:cursor-auto' : ''}`}
+ } ${clamped || expanded ? 'cursor-pointer' : ''}`}
>
<JournalBody text={story} />
</div>
{clamped && !expanded && (
<button
onClick={() => setExpanded(true)}
- className="md:hidden mt-2 inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 active:scale-95 transition-transform"
+ className="mt-2 inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700 active:scale-95 transition-all"
+ >
+ {t('common.showMore')} <ChevronRight size={10} />
+ </button>
+ )}
+ {expanded && (
+ <button
+ onClick={() => setExpanded(false)}
+ className="mt-2 inline-flex items-center gap-1 px-2.5 py-1 rounded-full bg-zinc-100 dark:bg-zinc-800 text-[10px] font-medium text-zinc-500 dark:text-zinc-400 hover:bg-zinc-200 dark:hover:bg-zinc-700 active:scale-95 transition-all"
>
- Read more <ChevronRight size={10} />
+ {t('common.showLess')} <ChevronRight size={10} className="rotate-[-90deg]" />
</button>
)}
</div>