Merge branch 'main' of github.com:remanso-space/remanso
This commit is contained in:
@@ -33,6 +33,7 @@ Run a single test file: `pnpm test src/modules/repo/services/resolvePath.spec.ts
|
|||||||
### Styling
|
### Styling
|
||||||
|
|
||||||
Tailwind v4 uses the modern CSS-based config in `src/styles/app.css`:
|
Tailwind v4 uses the modern CSS-based config in `src/styles/app.css`:
|
||||||
|
|
||||||
- `@import "tailwindcss"` instead of directives
|
- `@import "tailwindcss"` instead of directives
|
||||||
- DaisyUI configured via `@plugin 'daisyui' { themes: retro --default, coffee --prefersdark; }`
|
- DaisyUI configured via `@plugin 'daisyui' { themes: retro --default, coffee --prefersdark; }`
|
||||||
- `@tailwindcss/typography` for prose styling
|
- `@tailwindcss/typography` for prose styling
|
||||||
|
|||||||
@@ -9,18 +9,15 @@ import { getUrl } from "@/modules/atproto/getUrl"
|
|||||||
import { withATProtoImages } from "@/modules/atproto/withATProtoImages"
|
import { withATProtoImages } from "@/modules/atproto/withATProtoImages"
|
||||||
import { getAuthor } from "@/modules/atproto/getAuthor"
|
import { getAuthor } from "@/modules/atproto/getAuthor"
|
||||||
import { PublicNoteRecord } from "@/modules/atproto/publicNote.types"
|
import { PublicNoteRecord } from "@/modules/atproto/publicNote.types"
|
||||||
import { parseAtUri } from "@/modules/atproto/parseAtUri"
|
|
||||||
|
|
||||||
const props = defineProps<{
|
const props = defineProps<{
|
||||||
atUri: string
|
didrkey: string
|
||||||
index: number
|
index: number
|
||||||
title?: string
|
|
||||||
}>()
|
}>()
|
||||||
|
|
||||||
const atUri = computed(() => props.atUri)
|
const didrkey = computed(() => props.didrkey)
|
||||||
const atUriProps = computed(() => parseAtUri(atUri.value))
|
const did = computed(() => props.didrkey.split("-")[0])
|
||||||
const did = computed(() => atUriProps.value.did)
|
const rkey = computed(() => props.didrkey.split("-")[1])
|
||||||
const rkey = computed(() => atUriProps.value.rkey)
|
|
||||||
|
|
||||||
const index = computed(() => props.index)
|
const index = computed(() => props.index)
|
||||||
|
|
||||||
@@ -33,7 +30,7 @@ const className = computed(() => `stacked-note-${props.index}`)
|
|||||||
const titleClassName = computed(() => `title-${className.value}`)
|
const titleClassName = computed(() => `title-${className.value}`)
|
||||||
|
|
||||||
const { scrollToFocusedNote } = useRouteQueryStackedNotes()
|
const { scrollToFocusedNote } = useRouteQueryStackedNotes()
|
||||||
const { listenToClick } = useATProtoLinks(className.value, atUri)
|
const { listenToClick } = useATProtoLinks(className.value, didrkey)
|
||||||
const { displayNoteOverlay } = useNoteOverlay(className.value, index)
|
const { displayNoteOverlay } = useNoteOverlay(className.value, index)
|
||||||
|
|
||||||
const noteRecord = computedAsync(async () =>
|
const noteRecord = computedAsync(async () =>
|
||||||
@@ -70,12 +67,12 @@ watch(
|
|||||||
:class="{
|
:class="{
|
||||||
[className]: true,
|
[className]: true,
|
||||||
overlay: displayNoteOverlay,
|
overlay: displayNoteOverlay,
|
||||||
[`note-${rkey}`]: true,
|
[`note-${didrkey}`]: true,
|
||||||
}"
|
}"
|
||||||
>
|
>
|
||||||
<a
|
<a
|
||||||
class="title-stacked-note-link"
|
class="title-stacked-note-link"
|
||||||
@click.prevent="scrollToFocusedNote(rkey)"
|
@click.prevent="scrollToFocusedNote(didrkey)"
|
||||||
>
|
>
|
||||||
<div
|
<div
|
||||||
class="title-stacked-note breadcrumbs text-sm"
|
class="title-stacked-note breadcrumbs text-sm"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import { ComputedRef, onUnmounted, Ref, toValue } from "vue"
|
|||||||
import { isExternalLink } from "@/utils/link"
|
import { isExternalLink } from "@/utils/link"
|
||||||
import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
|
import { useRouteQueryStackedNotes } from "@/hooks/useRouteQueryStackedNotes.hook"
|
||||||
import { parseAtUri } from "@/modules/atproto/parseAtUri"
|
import { parseAtUri } from "@/modules/atproto/parseAtUri"
|
||||||
|
import { router } from "@/router/router"
|
||||||
|
|
||||||
export const useATProtoLinks = (
|
export const useATProtoLinks = (
|
||||||
className: ComputedRef<string> | string,
|
className: ComputedRef<string> | string,
|
||||||
@@ -11,26 +12,51 @@ export const useATProtoLinks = (
|
|||||||
const { addStackedNote } = useRouteQueryStackedNotes()
|
const { addStackedNote } = useRouteQueryStackedNotes()
|
||||||
const linkNote = (event: Event) => {
|
const linkNote = (event: Event) => {
|
||||||
const target = event.target as HTMLElement
|
const target = event.target as HTMLElement
|
||||||
const atUri = target.getAttribute("href")
|
const href = target.getAttribute("href")
|
||||||
|
|
||||||
if (!atUri) {
|
if (!href) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (atUri.startsWith("#")) {
|
if (href.startsWith("#")) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
event.stopPropagation()
|
event.stopPropagation()
|
||||||
|
|
||||||
if (isExternalLink(atUri)) {
|
if (isExternalLink(href)) {
|
||||||
window.open(atUri, "_blank")
|
window.open(href, "_blank")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const { rkey } = parseAtUri(atUri)
|
|
||||||
|
|
||||||
addStackedNote(toValue(currentAtUri) ?? "", atUri, rkey)
|
if (href.startsWith(window.location.origin)) {
|
||||||
|
const { params } = router.resolve(
|
||||||
|
href.replace(window.location.origin, ""),
|
||||||
|
)
|
||||||
|
|
||||||
|
if (!params.did || !params.rkey) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
const noteId = params.slug
|
||||||
|
? `${params.did}-${params.rkey}-${params.slug}`
|
||||||
|
: `${params.did}-${params.rkey}`
|
||||||
|
|
||||||
|
addStackedNote(
|
||||||
|
toValue(currentAtUri) ?? "",
|
||||||
|
noteId,
|
||||||
|
`${params.did}-${params.rkey}`,
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if (href.startsWith("at://")) {
|
||||||
|
const { did, rkey } = parseAtUri(href)
|
||||||
|
const noteId = `${did}-${rkey}`
|
||||||
|
|
||||||
|
addStackedNote(toValue(currentAtUri) ?? "", noteId)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const LINK_SELECTOR = `.${toValue(className)} a`
|
const LINK_SELECTOR = `.${toValue(className)} a`
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ import { watchEffect } from "vue"
|
|||||||
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
|
import { useUserRepoStore } from "@/modules/repo/store/userRepo.store"
|
||||||
import { downloadFont } from "@/utils/downloadFont"
|
import { downloadFont } from "@/utils/downloadFont"
|
||||||
|
|
||||||
const DEFAULT_FONT_POLICY = "Courier Prime,monospace"
|
const DEFAULT_FONT_POLICY = '"Libertinus Serif", serif'
|
||||||
const DEFAULT_FONT_SIZE = "16px"
|
const DEFAULT_FONT_SIZE = "16px"
|
||||||
|
|
||||||
export const useUserSettings = () => {
|
export const useUserSettings = () => {
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
@charset "utf-8";
|
@charset "utf-8";
|
||||||
@import "tailwindcss";
|
@import "tailwindcss";
|
||||||
|
|
||||||
@import url("https://fonts.googleapis.com/css2?display=swap&family=Courier+Prime");
|
@import url("https://fonts.googleapis.com/css2?display=swap&family=Courier+Prime&family=Libertinus+Serif");
|
||||||
|
|
||||||
:root {
|
:root {
|
||||||
--primary-color: #2c3a47;
|
--primary-color: #2c3a47;
|
||||||
--font-family: "Courier Prime", monospace;
|
--font-family: "Libertinus Serif", serif;
|
||||||
--font-size: 13pt;
|
--font-size: 13pt;
|
||||||
--font-color: #4a4a4a;
|
--font-color: #4a4a4a;
|
||||||
--link: #445fb9;
|
--link: #445fb9;
|
||||||
@@ -25,7 +25,7 @@
|
|||||||
@plugin 'daisyui' {
|
@plugin 'daisyui' {
|
||||||
themes:
|
themes:
|
||||||
garden --default,
|
garden --default,
|
||||||
night --prefersdark;
|
dim --prefersdark;
|
||||||
}
|
}
|
||||||
|
|
||||||
@config '../../tailwind.config.js';
|
@config '../../tailwind.config.js';
|
||||||
|
|||||||
@@ -3,5 +3,5 @@
|
|||||||
|
|
||||||
export const themeConfig = {
|
export const themeConfig = {
|
||||||
light: 'garden',
|
light: 'garden',
|
||||||
dark: 'night',
|
dark: 'dim',
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
export const LINKS = ['http://', 'https://']
|
export const LINKS = ["http://", "https://"]
|
||||||
|
|
||||||
export const isExternalLink = (href: string) =>
|
export const isExternalLink = (href: string) =>
|
||||||
|
!href.startsWith(window.location.origin) &&
|
||||||
LINKS.some((link) => href.startsWith(link))
|
LINKS.some((link) => href.startsWith(link))
|
||||||
|
|||||||
@@ -32,7 +32,11 @@ const author = computedAsync(async () => getAuthor(did.value))
|
|||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'PublicNoteView',
|
name: 'PublicNoteView',
|
||||||
params: { did: note.did, rkey: note.rkey, slug: slugify(note.title) },
|
params: {
|
||||||
|
did: note.did,
|
||||||
|
rkey: note.rkey,
|
||||||
|
slug: slugify(note.title),
|
||||||
|
},
|
||||||
}"
|
}"
|
||||||
class="btn btn-link"
|
class="btn btn-link"
|
||||||
>{{ note.title }}</router-link
|
>{{ note.title }}</router-link
|
||||||
@@ -87,6 +91,7 @@ const author = computedAsync(async () => getAuthor(did.value))
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
display: inline;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,11 @@ const { notes, isLoading, canLoadMore, onLoadMore, getAuthor } =
|
|||||||
<router-link
|
<router-link
|
||||||
:to="{
|
:to="{
|
||||||
name: 'PublicNoteView',
|
name: 'PublicNoteView',
|
||||||
params: { did: note.did, rkey: note.rkey, slug: slugify(note.title) },
|
params: {
|
||||||
|
did: note.did,
|
||||||
|
rkey: note.rkey,
|
||||||
|
slug: slugify(note.title),
|
||||||
|
},
|
||||||
}"
|
}"
|
||||||
class="btn btn-link"
|
class="btn btn-link"
|
||||||
>{{ note.title }}</router-link
|
>{{ note.title }}</router-link
|
||||||
@@ -95,6 +99,7 @@ const { notes, isLoading, canLoadMore, onLoadMore, getAuthor } =
|
|||||||
}
|
}
|
||||||
|
|
||||||
a {
|
a {
|
||||||
|
display: inline;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -133,7 +133,7 @@ watch(
|
|||||||
:key="stackedNote"
|
:key="stackedNote"
|
||||||
class="note"
|
class="note"
|
||||||
:index="index"
|
:index="index"
|
||||||
:at-uri="stackedNote"
|
:didrkey="stackedNote"
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ module.exports = {
|
|||||||
css: {
|
css: {
|
||||||
...defaultTitleStyles,
|
...defaultTitleStyles,
|
||||||
"font-size": "13pt",
|
"font-size": "13pt",
|
||||||
"font-family": '"Courier Prime", monospace',
|
"font-family": '"Libertinus Serif", serif',
|
||||||
p: {
|
p: {
|
||||||
"margin-top": "0.8em",
|
"margin-top": "0.8em",
|
||||||
"margin-bottom": "0.8em",
|
"margin-bottom": "0.8em",
|
||||||
|
|||||||
Reference in New Issue
Block a user