chore: format

This commit is contained in:
Freeplay 2023-06-15 21:06:50 -04:00
parent 11d4fdaea8
commit a441dd193d
11 changed files with 96 additions and 125 deletions

View file

@ -97,7 +97,8 @@
let fontSize = localStorage.getItem("fontSize"); let fontSize = localStorage.getItem("fontSize");
if (fontSize) { if (fontSize) {
if (fontSize < 10) { // need to do this for now, as values before were 1, 2, 3 depending on the option if (fontSize < 10) {
// need to do this for now, as values before were 1, 2, 3 depending on the option
localStorage.setItem("fontSize", null); localStorage.setItem("fontSize", null);
fontSize = localStorage.getItem("fontSize"); fontSize = localStorage.getItem("fontSize");
} }

View file

@ -1,7 +1,9 @@
<template> <template>
<div <div
class="instance-ticker" class="instance-ticker"
v-tooltip="instance.softwareName ? capitalize(instance.softwareName) : null" v-tooltip="
instance.softwareName ? capitalize(instance.softwareName) : null
"
ref="ticker" ref="ticker"
:style="bg" :style="bg"
> >

View file

@ -4,11 +4,7 @@
<slot name="key"></slot> <slot name="key"></slot>
</div> </div>
<div class="value"> <div class="value">
<Mfm <Mfm v-if="text" :text="text" :advancedMfm="false"></Mfm>
v-if="text"
:text="text"
:advancedMfm="false"
></Mfm>
<slot v-else name="value"></slot> <slot v-else name="value"></slot>
<button <button
v-if="copy" v-if="copy"

View file

@ -1,11 +1,5 @@
<template> <template>
<a <a v-if="to" class="mention" :href="to" rel="noopener" @click.stop>
v-if="to"
class="mention"
:href="to"
rel="noopener"
@click.stop
>
<i class="icon ph-bold ph-large" :class="'ph-' + icon"></i> <i class="icon ph-bold ph-large" :class="'ph-' + icon"></i>
<span class="main"> <span class="main">
<slot></slot> <slot></slot>
@ -58,19 +52,19 @@ const props = defineProps<{
icon?: string; icon?: string;
}>(); }>();
const canonical = const canonical = props.host
props.host ? ? props.host === localHost
props.host === localHost
? `@${props.username}` ? `@${props.username}`
: `@${props.username}@${toUnicode(props.host)}` : null; : `@${props.username}@${toUnicode(props.host)}`
: null;
const url = `/${canonical}`; const url = `/${canonical}`;
const isMe = const isMe = props.username
props.username ? ? $i &&
$i &&
`@${props.username}@${toUnicode(props.host)}` === `@${props.username}@${toUnicode(props.host)}` ===
`@${$i.username}@${toUnicode(localHost)}`.toLowerCase() : null; `@${$i.username}@${toUnicode(localHost)}`.toLowerCase()
: null;
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -115,7 +109,7 @@ const isMe =
> i.icon { > i.icon {
vertical-align: middle; vertical-align: middle;
font-size: 1.2em; font-size: 1.2em;
margin-left: .4em; margin-left: 0.4em;
} }
> .main > .host { > .main > .host {

View file

@ -75,10 +75,7 @@
<div class="main"> <div class="main">
<div class="header-container"> <div class="header-container">
<MkAvatar class="avatar" :user="appearNote.user" /> <MkAvatar class="avatar" :user="appearNote.user" />
<XNoteHeader <XNoteHeader class="header" :note="appearNote" />
class="header"
:note="appearNote"
/>
</div> </div>
<div class="body"> <div class="body">
<MkSubNoteContent <MkSubNoteContent

View file

@ -62,7 +62,7 @@ const props = defineProps<{
background: var(--buttonBg); background: var(--buttonBg);
border-radius: 6px; border-radius: 6px;
font-size: 0.9em; font-size: 0.9em;
transition: background .2s; transition: background 0.2s;
&._button:hover { &._button:hover {
text-decoration: none; text-decoration: none;

View file

@ -79,7 +79,9 @@
ref="tabsEl" ref="tabsEl"
v-if="hasTabs" v-if="hasTabs"
class="tabs" class="tabs"
:class="{ collapse: hasTabs && tabs.length > 3 && !noTabCollapse }" :class="{
collapse: hasTabs && tabs.length > 3 && !noTabCollapse,
}"
> >
<button <button
v-for="tab in tabs" v-for="tab in tabs"
@ -183,10 +185,9 @@ const props = withDefaults(
to?: string; to?: string;
}>(), }>(),
{ {
displayHomeButton: !$i displayHomeButton: !$i,
} }
) );
const displayBackButton = const displayBackButton =
props.displayBackButton && props.displayBackButton &&

View file

@ -152,11 +152,13 @@ watch($$(tab), () => syncSlide(tabs.indexOf(tab)));
const headerActions = $computed(() => []); const headerActions = $computed(() => []);
const headerTabs = $computed(() => [ const headerTabs = $computed(() => [
!isDesktop ? { !isDesktop
? {
key: "home", key: "home",
icon: "ph-house ph-bold ph-lg", icon: "ph-house ph-bold ph-lg",
title: i18n.ts.home, title: i18n.ts.home,
} : [], }
: [],
{ {
key: "local", key: "local",
icon: "ph-lightning ph-bold ph-lg", icon: "ph-lightning ph-bold ph-lg",
@ -220,10 +222,9 @@ let wallpaper = $ref(String);
os.api("meta", { detail: true }).then((res) => { os.api("meta", { detail: true }).then((res) => {
meta = res; meta = res;
wallpaper = `url("${res.backgroundImageUrl}")` wallpaper = `url("${res.backgroundImageUrl}")`;
}); });
const paginationForLocal = { const paginationForLocal = {
endpoint: "notes/featured" as const, endpoint: "notes/featured" as const,
limit: 10, limit: 10,

View file

@ -23,7 +23,6 @@
<XWidgets @mounted="attachSticky" /> <XWidgets @mounted="attachSticky" />
</div> </div>
<button <button
v-if="!isDesktop && !isMobile" v-if="!isDesktop && !isMobile"
class="widgetButton _button" class="widgetButton _button"

View file

@ -1,9 +1,10 @@
<template> <template>
<XKanban sticky v-if="isDesktop" /> <XKanban sticky v-if="isDesktop" />
<main <main id="maincontent">
id="maincontent" <XKanban
> mini
<XKanban mini v-if="!isDesktop && mainRouter.currentRoute.value.name !== 'index'" /> v-if="!isDesktop && mainRouter.currentRoute.value.name !== 'index'"
/>
<RouterView /> <RouterView />
<footer class="powered-by"> <footer class="powered-by">
<MkA to="/"> <MkA to="/">

View file

@ -1,51 +1,34 @@
<template> <template>
<header v-if="mini" class="mini-header"> <header v-if="mini" class="mini-header">
<img <img class="logo" :src="meta.logoImageUrl" />
class="logo"
:src="meta.logoImageUrl"
/>
<h1> <h1>
<MkA <MkA to="/" class="link">{{ instanceName }}</MkA>
to="/" class="link"
>{{ instanceName }}</MkA>
</h1> </h1>
<MkButton <MkButton class="home" :to="'/'" link rounded>
class="home"
:to="'/'"
link
rounded
>
<i class="ph-house ph-bold ph-lg"></i> <i class="ph-house ph-bold ph-lg"></i>
{{ i18n.ts.home }} {{ i18n.ts.home }}
</MkButton> </MkButton>
</header> </header>
<div class="instance-info-container" <div class="instance-info-container" v-else :class="{ sticky }">
v-else <header id="instance-info" v-on:scroll.passive="onScroll">
:class="{ sticky }"
>
<header
id="instance-info"
v-on:scroll.passive="onScroll"
>
<div class="banner"> <div class="banner">
<img :src="meta.backgroundImageUrl" /> <img :src="meta.backgroundImageUrl" />
</div> </div>
<div class="content"> <div class="content">
<div class="header"> <div class="header">
<img <img class="logo" :src="meta.logoImageUrl" />
class="logo"
:src="meta.logoImageUrl"
/>
<h1> <h1>
<MkA <MkA to="/" class="link">{{ instanceName }}</MkA>
to="/" class="link"
>{{ instanceName }}</MkA>
</h1> </h1>
</div> </div>
<!-- <MkA class="_buttonIcon home" :to="'/'" v-tooltip="i18n.ts.home"> <!-- <MkA class="_buttonIcon home" :to="'/'" v-tooltip="i18n.ts.home">
<i class="ph-house ph-bold ph-lg"></i> <i class="ph-house ph-bold ph-lg"></i>
</MkA> --> </MkA> -->
<button class="_buttonIcon menu" @click="showMenu" v-tooltip="i18n.ts.more"> <button
class="_buttonIcon menu"
@click="showMenu"
v-tooltip="i18n.ts.more"
>
<i class="ph-dots-three-outline ph-bold ph-lg"></i> <i class="ph-dots-three-outline ph-bold ph-lg"></i>
</button> </button>
<div v-if="meta" class="about"> <div v-if="meta" class="about">
@ -63,23 +46,12 @@
<section> <section>
<div class="_formLinksGridFlex"> <div class="_formLinksGridFlex">
<MkButton <MkButton primary gradate rounded @click="signup">
primary gradate <i class="ph-sign-in ph-bold"></i>
rounded
@click="signup"
>
<i
class="ph-sign-in ph-bold"
></i>
{{ i18n.ts.signup }} {{ i18n.ts.signup }}
</MkButton> </MkButton>
<MkButton <MkButton rounded @click="signin">
rounded <i class="ph-sign-out ph-bold"></i>
@click="signin"
>
<i
class="ph-sign-out ph-bold"
></i>
{{ i18n.ts.login }} {{ i18n.ts.login }}
</MkButton> </MkButton>
<MkButton <MkButton
@ -88,9 +60,7 @@
rounded rounded
to="https://calckey.org/join/" to="https://calckey.org/join/"
> >
<i <i class="ph-airplane-tilt ph-bold"></i>
class="ph-airplane-tilt ph-bold"
></i>
{{ i18n.ts.findAnotherInstance }} {{ i18n.ts.findAnotherInstance }}
</MkButton> </MkButton>
<MkButton <MkButton
@ -100,9 +70,7 @@
rounded rounded
to="https://calckey.org/apps/" to="https://calckey.org/apps/"
> >
<i <i class="ph-device-mobile ph-bold"></i>
class="ph-device-mobile ph-bold"
></i>
{{ i18n.ts.apps }} {{ i18n.ts.apps }}
</MkButton> </MkButton>
</div> </div>
@ -114,30 +82,37 @@
</p> </p>
<FormSection v-if="announcement"> <FormSection v-if="announcement">
<FormLink :to="'/announcements'" <FormLink :to="'/announcements'" naked
naked
><template #icon ><template #icon
><i ><i
class="ph-megaphone-simple ph-bold ph-lg _flip" class="ph-megaphone-simple ph-bold ph-lg _flip"
></i></template ></i></template
>{{ announcement.title }}: >{{ announcement.title }}:
<span style="opacity: 0.8; font-weight: 400;">{{ announcement.text }}</span> <span style="opacity: 0.8; font-weight: 400">{{
announcement.text
}}</span>
</FormLink> </FormLink>
</FormSection> </FormSection>
<FormSection v-if="meta.maintainerName || meta.maintainerEmail"> <FormSection
v-if="meta.maintainerName || meta.maintainerEmail"
>
<div class="_formLinksGrid"> <div class="_formLinksGrid">
<MkKeyValue v-if="meta.maintainerName" :text="meta.maintainerName"> <MkKeyValue
v-if="meta.maintainerName"
:text="meta.maintainerName"
>
<template #key>{{ <template #key>{{
i18n.ts.administrator i18n.ts.administrator
}}</template> }}</template>
</MkKeyValue> </MkKeyValue>
<MkKeyValue v-if="meta.maintainerEmail"> <MkKeyValue v-if="meta.maintainerEmail">
<template #key>{{ <template #key>{{ i18n.ts.contact }}</template>
i18n.ts.contact
}}</template>
<template #value> <template #value>
<MkMention :to="'mailto:' + meta.maintainerEmail" :icon="'envelope'"> <MkMention
:to="'mailto:' + meta.maintainerEmail"
:icon="'envelope'"
>
{{ meta.maintainerEmail }} {{ meta.maintainerEmail }}
</MkMention> </MkMention>
</template> </template>
@ -225,17 +200,16 @@ let collapsed = $ref(!isLong);
os.api("meta", { detail: true }).then((res) => { os.api("meta", { detail: true }).then((res) => {
meta = res; meta = res;
isLong = meta.description && (meta.description.length > 500); isLong = meta.description && meta.description.length > 500;
}); });
let announcement = $ref(); let announcement = $ref();
os.api("announcements", { os.api("announcements", {
limit: 1 limit: 1,
}).then((res) => { }).then((res) => {
announcement = res[0]; announcement = res[0];
}); });
function signin() { function signin() {
os.popup( os.popup(
XSigninDialog, XSigninDialog,
@ -245,7 +219,7 @@ function signin() {
{}, {},
"closed" "closed"
); );
}; }
function signup() { function signup() {
os.popup( os.popup(
@ -256,7 +230,7 @@ function signup() {
{}, {},
"closed" "closed"
); );
}; }
function showMenu(ev) { function showMenu(ev) {
openHelpMenu_(ev); openHelpMenu_(ev);
} }
@ -312,7 +286,7 @@ function showMenu(ev) {
background: var(--accent); background: var(--accent);
height: max-content; height: max-content;
min-height: 100%; min-height: 100%;
transition: transform .4s cubic-bezier(.5,0,0,1); transition: transform 0.4s cubic-bezier(0.5, 0, 0, 1);
.banner { .banner {
position: sticky; position: sticky;
top: 0; top: 0;
@ -320,7 +294,7 @@ function showMenu(ev) {
margin-inline: -1px; margin-inline: -1px;
padding-top: 56.25%; padding-top: 56.25%;
mask: linear-gradient(to bottom, black, calc(100% - 50px), transparent); mask: linear-gradient(to bottom, black, calc(100% - 50px), transparent);
transition: min-height .4s, max-height .4s, filter .7s; transition: min-height 0.4s, max-height 0.4s, filter 0.7s;
img { img {
position: absolute; position: absolute;
width: 100%; width: 100%;
@ -360,7 +334,11 @@ function showMenu(ev) {
z-index: -1; z-index: -1;
clip-path: inset(55px 0 0 0 round var(--radius)); clip-path: inset(55px 0 0 0 round var(--radius));
mask: linear-gradient(transparent 55px, #000 50px, transparent); mask: linear-gradient(transparent 55px, #000 50px, transparent);
-webkit-mask: linear-gradient(transparent 55px, #000 50px, transparent); -webkit-mask: linear-gradient(
transparent 55px,
#000 50px,
transparent
);
} }
> .logo { > .logo {
height: 90px; height: 90px;
@ -368,22 +346,23 @@ function showMenu(ev) {
max-width: 100%; max-width: 100%;
border-radius: var(--radius); border-radius: var(--radius);
margin-top: -5px; margin-top: -5px;
transition: transform .4s cubic-bezier(0.5,0,0,1); transition: transform 0.4s cubic-bezier(0.5, 0, 0, 1);
} }
> h1 { > h1 {
margin-block: .7em; margin-block: 0.7em;
font-size: 1.5em; font-size: 1.5em;
color: var(--fgHighlighted) color: var(--fgHighlighted);
} }
} }
.menu, .home { .menu,
.home {
position: absolute; position: absolute;
top: 10px; top: 10px;
right: 10px; right: 10px;
width: 42px; width: 42px;
height: 42px; height: 42px;
border-radius: 100px; border-radius: 100px;
background: var(--buttonBg) background: var(--buttonBg);
} }
.home { .home {
right: unset; right: unset;