Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/lib/app/i18n/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "العودة إلى الأعلى"
},
"message": {
"success": "Success",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Премахване",
"download": "Изтегляне",
"attach": "Прикачване на файл",
"info": "Информация"
"info": "Информация",
"backToTop": "Обратно горе"
},
"message": {
"success": "Успех",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Eliminar",
"download": "Descarregar",
"attach": "Adjuntar fitxer",
"info": "Informació"
"info": "Informació",
"backToTop": "Torna a dalt"
},
"message": {
"success": "Èxit",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Entfernen",
"download": "Herunterladen",
"attach": "Datei anhängen",
"info": "Info"
"info": "Info",
"backToTop": "Nach oben"
},
"message": {
"success": "Erfolg",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Back to top"
},
"message": {
"success": "Success",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Eliminar",
"download": "Descargar",
"attach": "Adjuntar archivo",
"info": "Info"
"info": "Info",
"backToTop": "Volver arriba"
},
"message": {
"success": "Éxito",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/et.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Tagasi üles"
},
"message": {
"success": "Success",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Poista",
"download": "Lataa",
"attach": "Liitä tiedosto",
"info": "Tietoja"
"info": "Tietoja",
"backToTop": "Takaisin ylös"
},
"message": {
"success": "Onnistui",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Supprimer",
"download": "Télécharger",
"attach": "Joindre un fichier",
"info": "Info"
"info": "Info",
"backToTop": "Haut de page"
},
"message": {
"success": "Succès",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/he.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "הסר",
"download": "הורד",
"attach": "צרף קובץ",
"info": "מידע"
"info": "מידע",
"backToTop": "חזרה למעלה"
},
"message": {
"success": "הצלחה",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Vissza a tetejére"
},
"message": {
"success": "Siker",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "削除",
"download": "ダウンロード",
"attach": "ファイルを添付",
"info": "情報"
"info": "情報",
"backToTop": "トップへ戻る"
},
"message": {
"success": "成功",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Terug naar boven"
},
"message": {
"success": "Succes",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/pl.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Usuń",
"download": "Pobierz",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Powrót na górę"
},
"message": {
"success": "Sukces",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/pt-BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remover",
"download": "Baixar",
"attach": "Anexar arquivo",
"info": "Info"
"info": "Info",
"backToTop": "Voltar ao topo"
},
"message": {
"success": "Sucesso",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/pt.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Voltar ao topo"
},
"message": {
"success": "Sucesso",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/ru.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Удалить",
"download": "Скачать",
"attach": "Добавить файл",
"info": "Информация"
"info": "Информация",
"backToTop": "Наверх"
},
"message": {
"success": "Успех",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/tok.json
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,8 @@
"remove": "o weka",
"cancel": "ala",
"save": "o olin",
"send": "o toki"
"send": "o toki",
"backToTop": "o tawa sewi"
},
"error": {
"incorrect_login_7": "sina musi?",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/tr.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "Remove",
"download": "Download",
"attach": "Attach file",
"info": "Info"
"info": "Info",
"backToTop": "Başa dön"
},
"message": {
"success": "Başarı",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/zh-Hans.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "移除",
"download": "下载",
"attach": "附加文件",
"info": "信息"
"info": "信息",
"backToTop": "回到顶部"
},
"message": {
"success": "成功",
Expand Down
3 changes: 2 additions & 1 deletion src/lib/app/i18n/zh-Hant.json
Original file line number Diff line number Diff line change
Expand Up @@ -695,7 +695,8 @@
"remove": "移除",
"download": "下載",
"attach": "附加檔案",
"info": "資訊"
"info": "資訊",
"backToTop": "回到頂部"
},
"message": {
"success": "成功",
Expand Down
6 changes: 5 additions & 1 deletion src/lib/feature/post/actions/PostActions.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
BugAnt,
ChatBubbleOvalLeft,
ChatBubbleOvalLeftEllipsis,
Check,
EllipsisHorizontal,
GlobeAlt,
Icon,
Expand All @@ -38,6 +39,7 @@

let saving = $state(false)
let editing = $state(false)
let copied = $state(false)

interface Props {
post: PostView
Expand Down Expand Up @@ -73,6 +75,8 @@
else {
navigator.clipboard.writeText(link)
toast({ content: $t('toast.copied') })
copied = true
setTimeout(() => (copied = false), 2000)
}
}
</script>
Expand Down Expand Up @@ -202,7 +206,7 @@
onclick={() => {
if (post.post.local) share()
}}
icon={Share}
icon={copied ? Check : Share}
title={$t('post.actions.more.share')}
/>
{/snippet}
Expand Down
6 changes: 5 additions & 1 deletion src/lib/feature/post/feed/VirtualFeed.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,11 @@
'Lemmy. There are no more posts. You saw them all.',
})}
{#snippet action()}
<Button color="tertiary" icon={ChevronDoubleUp}>
<Button
color="tertiary"
icon={ChevronDoubleUp}
onclick={() => window.scrollTo({ top: 0, behavior: 'smooth' })}
>
{$t('routes.post.scrollToTop')}
</Button>
{/snippet}
Expand Down
32 changes: 32 additions & 0 deletions src/lib/ui/layout/BackToTop.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<script lang="ts">
import { t } from '$lib/app/i18n'
import { Button } from 'mono-svelte'
import { ArrowUp } from 'svelte-hero-icons/dist'
import { onMount } from 'svelte'

let visible = $state(false)

onMount(() => {
const handleScroll = () => {
visible = window.scrollY > 300
}
window.addEventListener('scroll', handleScroll)
return () => window.removeEventListener('scroll', handleScroll)
})

const scrollToTop = () => {
window.scrollTo({ top: 0, behavior: 'smooth' })
}
</script>

{#if visible}
<Button
class="fixed bottom-20 right-4 z-40 shadow-lg md:bottom-8 md:right-8"
onclick={scrollToTop}
icon={ArrowUp}
label={$t('common.backToTop')}
size="custom"
rounding="full"
color="primary"
/>
{/if}
2 changes: 2 additions & 0 deletions src/routes/+layout.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import Moderation from '$lib/feature/moderation/Moderation.svelte'
import ExpandableImage from '$lib/ui/generic/ExpandableImage.svelte'
import { Shell } from '$lib/ui/layout'
import BackToTop from '$lib/ui/layout/BackToTop.svelte'
import Navbar from '$lib/ui/navbar/Navbar.svelte'
import Sidebar from '$lib/ui/sidebar/Sidebar.svelte'
import { Button, ModalContainer, Spinner, ToastContainer } from 'mono-svelte'
Expand Down Expand Up @@ -135,6 +136,7 @@
<ToastContainer />
<ExpandableImage />
<ModalContainer />
<BackToTop />

{#snippet sidebar({ style: s, class: c })}
<Sidebar class={[c, 'p-3 sm:p-6 w-full']} style={s} />
Expand Down