Skip to content

Commit 2df242d

Browse files
Merge branch 'main' into refactor/remove-redirect-on-typing
2 parents 2c5502d + f80f5a5 commit 2df242d

21 files changed

Lines changed: 160 additions & 12 deletions

File tree

app/components/FilterPanel.vue

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,11 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
250250
role="radio"
251251
:aria-checked="filters.downloadRange === range.value"
252252
class="tag transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
253-
:class="filters.downloadRange === range.value ? 'bg-fg text-bg border-fg' : ''"
253+
:class="
254+
filters.downloadRange === range.value
255+
? 'bg-fg text-bg border-fg hover:text-bg/50'
256+
: ''
257+
"
254258
@click="emit('update:downloadRange', range.value)"
255259
>
256260
{{ $t(getDownloadRangeLabelKey(range.value)) }}
@@ -275,7 +279,11 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
275279
role="radio"
276280
:aria-checked="filters.updatedWithin === option.value"
277281
class="tag transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
278-
:class="filters.updatedWithin === option.value ? 'bg-fg text-bg border-fg' : ''"
282+
:class="
283+
filters.updatedWithin === option.value
284+
? 'bg-fg text-bg border-fg hover:text-bg/70'
285+
: ''
286+
"
279287
@click="emit('update:updatedWithin', option.value)"
280288
>
281289
{{ $t(getUpdatedWithinLabelKey(option.value)) }}
@@ -300,7 +308,9 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
300308
disabled
301309
:aria-checked="filters.security === option.value"
302310
class="tag transition-colors duration-200 opacity-50 cursor-not-allowed focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
303-
:class="filters.security === option.value ? 'bg-fg text-bg border-fg' : ''"
311+
:class="
312+
filters.security === option.value ? 'bg-fg text-bg border-fg hover:text-bg/70' : ''
313+
"
304314
>
305315
{{ $t(getSecurityLabelKey(option.value)) }}
306316
</button>
@@ -319,7 +329,9 @@ const hasActiveFilters = computed(() => !!filterSummary.value)
319329
type="button"
320330
:aria-pressed="filters.keywords.includes(keyword)"
321331
class="tag text-xs transition-colors duration-200 focus-visible:ring-2 focus-visible:ring-fg focus-visible:ring-offset-1"
322-
:class="filters.keywords.includes(keyword) ? 'bg-fg text-bg border-fg' : ''"
332+
:class="
333+
filters.keywords.includes(keyword) ? 'bg-fg text-bg border-fg hover:text-bg/70' : ''
334+
"
323335
@click="emit('toggleKeyword', keyword)"
324336
>
325337
{{ keyword }}

app/pages/code/[...path].vue

Lines changed: 60 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,22 @@ const canonicalUrl = computed(() => {
243243
return url
244244
})
245245
246+
// Toggle markdown view mode
247+
const markdownViewModes = [
248+
{
249+
key: 'preview',
250+
label: $t('code.markdown_view_mode.preview'),
251+
icon: 'i-carbon-view',
252+
},
253+
{
254+
key: 'code',
255+
label: $t('code.markdown_view_mode.code'),
256+
icon: 'i-carbon-code',
257+
},
258+
] as const
259+
260+
const markdownViewMode = ref<(typeof markdownViewModes)[number]['key']>('preview')
261+
246262
useHead({
247263
link: [{ rel: 'canonical', href: canonicalUrl }],
248264
})
@@ -359,15 +375,39 @@ useSeoMeta({
359375
<!-- File viewer -->
360376
<template v-if="isViewingFile && fileContent">
361377
<div
362-
class="sticky top-0 bg-bg border-b border-border px-4 py-2 flex items-center justify-between"
378+
class="sticky z-10 top-0 bg-bg border-b border-border px-4 py-2 flex items-center justify-between"
363379
>
364-
<div class="flex items-center gap-3 text-sm">
365-
<span class="text-fg-muted">{{
366-
$t('code.lines', { count: fileContent.lines })
367-
}}</span>
368-
<span v-if="currentNode?.size" class="text-fg-subtle">{{
369-
formatBytes(currentNode.size)
370-
}}</span>
380+
<div class="flex items-center gap-2">
381+
<div
382+
v-if="fileContent.markdownHtml"
383+
class="flex items-center gap-1 p-0.5 bg-bg-subtle border border-border-subtle rounded-md overflow-x-auto"
384+
role="tablist"
385+
aria-label="Markdown view mode selector"
386+
>
387+
<button
388+
v-for="mode in markdownViewModes"
389+
:key="mode.key"
390+
role="tab"
391+
class="px-2 py-1.5 font-mono text-xs rounded transition-colors duration-150 border border-solid focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-fg/50 inline-flex items-center gap-1.5"
392+
:class="
393+
markdownViewMode === mode.key
394+
? 'bg-bg shadow text-fg border-border'
395+
: 'text-fg-subtle hover:text-fg border-transparent'
396+
"
397+
@click="markdownViewMode = mode.key"
398+
>
399+
<span class="inline-block h-3 w-3" :class="mode.icon" aria-hidden="true" />
400+
{{ mode.label }}
401+
</button>
402+
</div>
403+
<div class="flex items-center gap-3 text-sm">
404+
<span class="text-fg-muted">{{
405+
$t('code.lines', { count: fileContent.lines })
406+
}}</span>
407+
<span v-if="currentNode?.size" class="text-fg-subtle">{{
408+
formatBytes(currentNode.size)
409+
}}</span>
410+
</div>
371411
</div>
372412
<div class="flex items-center gap-2">
373413
<button
@@ -389,7 +429,19 @@ useSeoMeta({
389429
</a>
390430
</div>
391431
</div>
432+
<div
433+
v-if="fileContent.markdownHtml"
434+
v-show="markdownViewMode === 'preview'"
435+
class="flex justify-center p-4"
436+
>
437+
<div
438+
class="readme-content prose prose-invert max-w-[70ch]"
439+
v-html="fileContent.markdownHtml.html"
440+
></div>
441+
</div>
442+
392443
<CodeViewer
444+
v-show="!fileContent.markdownHtml || markdownViewMode === 'code'"
393445
:html="fileContent.html"
394446
:lines="fileContent.lines"
395447
:selected-lines="selectedLines"

i18n/locales/ar.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@
532532
"table": {
533533
"name": "الاسم",
534534
"size": "الحجم"
535+
},
536+
"markdown_view_mode": {
537+
"preview": "معاينة",
538+
"code": "الكود"
535539
}
536540
},
537541
"badges": {

i18n/locales/de-DE.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,10 @@
532532
"table": {
533533
"name": "Name",
534534
"size": "Größe"
535+
},
536+
"markdown_view_mode": {
537+
"preview": "Vorschau",
538+
"code": "Code"
535539
}
536540
},
537541
"badges": {

i18n/locales/en.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,10 @@
550550
"table": {
551551
"name": "Name",
552552
"size": "Size"
553+
},
554+
"markdown_view_mode": {
555+
"preview": "preview",
556+
"code": "code"
553557
}
554558
},
555559
"badges": {

i18n/locales/es.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,10 @@
535535
"table": {
536536
"name": "Nombre",
537537
"size": "Tamaño"
538+
},
539+
"markdown_view_mode": {
540+
"preview": "vista previa",
541+
"code": "código"
538542
}
539543
},
540544
"badges": {

i18n/locales/fr-FR.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@
537537
"table": {
538538
"name": "Nom",
539539
"size": "Taille"
540+
},
541+
"markdown_view_mode": {
542+
"preview": "aperçu",
543+
"code": "code"
540544
}
541545
},
542546
"badges": {

i18n/locales/it-IT.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@
537537
"table": {
538538
"name": "Nome",
539539
"size": "Dimensione"
540+
},
541+
"markdown_view_mode": {
542+
"preview": "anteprima",
543+
"code": "codice"
540544
}
541545
},
542546
"filters": {

i18n/locales/ja-JP.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -537,6 +537,10 @@
537537
"table": {
538538
"name": "名前",
539539
"size": "サイズ"
540+
},
541+
"markdown_view_mode": {
542+
"preview": "プレビュー",
543+
"code": "コード"
540544
}
541545
},
542546
"badges": {

i18n/locales/zh-CN.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,6 +546,10 @@
546546
"table": {
547547
"name": "名称",
548548
"size": "大小"
549+
},
550+
"markdown_view_mode": {
551+
"preview": "预览",
552+
"code": "代码"
549553
}
550554
},
551555
"badges": {

0 commit comments

Comments
 (0)