Merge branch 'main' into feat-increase-status-preview-card-image-quality

This commit is contained in:
Shinigami 2022-12-12 22:18:51 +01:00 committed by GitHub
commit 49a9291339
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 49 additions and 6 deletions

View file

@ -1,4 +1,5 @@
<script setup lang="ts">
setupLogging()
setupPageHeader()
await setupI18n()
provideGlobalCommands()

View file

@ -16,7 +16,7 @@ const error = $ref(false)
:alt="$t('account.avatar_description', [account.username])"
loading="lazy"
rounded-full
:class="loaded ? 'bg-gray' : 'bg-gray:10'"
:class="loaded ? 'bg-base' : 'bg-gray:10'"
v-bind="$attrs"
@load="loaded = true"
@error="error = true"

View file

@ -57,6 +57,7 @@ const filterPhrase = $computed(() => filter?.phrase || (filter as any)?.title)
const isFiltered = $computed(() => filterPhrase && (props.context ? filter?.context.includes(props.context) : false))
const avatarOnAvatar = $(computedEager(() => useFeatureFlags().experimentalAvatarOnAvatar))
const showRebloggedByAvatarOnAvatar = rebloggedBy && avatarOnAvatar && rebloggedBy.id !== status.account.id
</script>
<template>
@ -69,12 +70,12 @@ const avatarOnAvatar = $(computedEager(() => useFeatureFlags().experimentalAvata
<div v-if="decorated || rebloggedBy || (showReplyTo && status.inReplyToAccountId)" h-6 />
<div flex gap-4>
<div relative>
<AccountHoverWrapper :account="status.account" :class="rebloggedBy && avatarOnAvatar ? 'mt-4' : 'mt-1'">
<AccountHoverWrapper :account="status.account" :class="showRebloggedByAvatarOnAvatar ? 'mt-4' : 'mt-1'">
<NuxtLink :to="getAccountRoute(status.account)" rounded-full>
<AccountAvatar w-12 h-12 :account="status.account" />
</NuxtLink>
</AccountHoverWrapper>
<div v-if="(rebloggedBy && avatarOnAvatar && rebloggedBy.id !== status.account.id)" absolute class="-top-2 -left-2" w-9 h-9 border-bg-base border-3 rounded-full>
<div v-if="showRebloggedByAvatarOnAvatar" absolute class="-top-2 -left-2" w-9 h-9 border-bg-base border-3 rounded-full>
<AccountAvatar :account="rebloggedBy" />
</div>
</div>

21
composables/log.ts Normal file
View file

@ -0,0 +1,21 @@
import * as log from 'tauri-plugin-log-api'
// When running inside Tauri, catch all logs from 3rd party packages and direct them to the unified logging stream
export function setupLogging() {
if (import.meta.env.TAURI_PLATFORM) {
// eslint-disable-next-line no-global-assign
console = {
...console,
trace: log.trace,
debug: log.debug,
log: log.info,
warn: log.warn,
error: log.error,
}
window.addEventListener('unhandledrejection', err =>
log.error(err.reason),
)
window.addEventListener('error', err => log.error(err.error), true)
}
}

View file

@ -32,6 +32,10 @@ export default defineNuxtConfig({
querystring: 'rollup-plugin-node-polyfills/polyfills/qs',
},
vite: {
// to make use of `TAURI_PLATFORM`, `TAURI_ARCH`, `TAURI_FAMILY`,
// `TAURI_PLATFORM_VERSION`, `TAURI_PLATFORM_TYPE` and `TAURI_DEBUG`
// env variables
envPrefix: ['VITE_', 'TAURI_'],
define: {
'import.meta.env.__BUILD_TIME__': JSON.stringify(new Date().toISOString()),
'import.meta.env.__BUILD_COMMIT__': JSON.stringify(process.env.COMMIT_REF || ''),
@ -39,7 +43,7 @@ export default defineNuxtConfig({
'process.mock': ((!isCI || isPreview) && process.env.MOCK_USER) || 'false',
},
build: {
target: 'esnext',
target: process.env.TAURI_PLATFORM ? ['es2021', 'chrome100', 'safari13'] : 'esnext',
},
plugins: [
Inspect(),

View file

@ -18,7 +18,8 @@
"postinstall": "nuxi prepare && simple-git-hooks"
},
"dependencies": {
"@fnando/sparkline": "^0.3.10"
"@fnando/sparkline": "^0.3.10",
"tauri-plugin-log-api": "github:tauri-apps/tauri-plugin-log"
},
"devDependencies": {
"@antfu/eslint-config": "^0.33.1",

View file

@ -57,6 +57,7 @@ specifiers:
shiki-es: ^0.1.2
simple-git-hooks: ^2.8.1
std-env: ^3.3.1
tauri-plugin-log-api: github:tauri-apps/tauri-plugin-log
theme-vitesse: ^0.6.0
tippy.js: ^6.3.7
typescript: ^4.9.3
@ -71,6 +72,7 @@ specifiers:
dependencies:
'@fnando/sparkline': 0.3.10
tauri-plugin-log-api: github.com/tauri-apps/tauri-plugin-log/b58475bbc410fa78eb69276c62d0b64c91c07914
devDependencies:
'@antfu/eslint-config': 0.33.1_s5ps7njkmjlaqajutnox5ntcla
@ -1316,6 +1318,11 @@ packages:
rollup: 2.79.1
dev: true
/@tauri-apps/api/1.2.0:
resolution: {integrity: sha512-lsI54KI6HGf7VImuf/T9pnoejfgkNoXveP14pVV7XarrQ46rOejIVJLFqHI9sRReJMGdh2YuCoI3cc/yCWCsrw==}
engines: {node: '>= 14.6.0', npm: '>= 6.6.0', yarn: '>= 1.19.1'}
dev: false
/@tiptap/core/2.0.0-beta.204:
resolution: {integrity: sha512-MH4LQE6rvX+DAy83tZH5E6gaA/hO5A6F/w5ZM6En5PcRhNsgpfQl+kjRfeVQYahxouc1mzetayhRe4XQ8PAwng==}
dependencies:
@ -8243,7 +8250,6 @@ packages:
/tslib/2.4.1:
resolution: {integrity: sha512-tGyy4dAjRIEwI7BzsB0lynWgOpfqjUdq91XXAlIWD2OwKBH7oCl/GZG/HT4BOHrTlPMOASlMQ7veyTqpmRcrNA==}
dev: true
/tsutils/3.21.0_typescript@4.9.3:
resolution: {integrity: sha512-mHKK3iUXL+3UF6xL5k0PEhKRUBKPBCv/+RkEOpjRWxxx27KKRBmmA60A9pgOUvMi8GKhRMPEmjBRPzs2W7O1OA==}
@ -9280,3 +9286,12 @@ packages:
compress-commons: 4.1.1
readable-stream: 3.6.0
dev: true
github.com/tauri-apps/tauri-plugin-log/b58475bbc410fa78eb69276c62d0b64c91c07914:
resolution: {tarball: https://codeload.github.com/tauri-apps/tauri-plugin-log/tar.gz/b58475bbc410fa78eb69276c62d0b64c91c07914}
name: tauri-plugin-log-api
version: 0.1.0
dependencies:
'@tauri-apps/api': 1.2.0
tslib: 2.4.1
dev: false