add contact info

This commit is contained in:
Freeplay 2023-06-13 20:54:28 -04:00
parent 3c0ffcaf71
commit ac082353d6
3 changed files with 85 additions and 10 deletions

View file

@ -4,7 +4,11 @@
<slot name="key"></slot> <slot name="key"></slot>
</div> </div>
<div class="value"> <div class="value">
<slot name="value"></slot> <Mfm
v-if="text"
:text="text"
></Mfm>
<slot v-else name="value"></slot>
<button <button
v-if="copy" v-if="copy"
v-tooltip="i18n.ts.copy" v-tooltip="i18n.ts.copy"
@ -26,6 +30,7 @@ import { i18n } from "@/i18n";
const props = withDefaults( const props = withDefaults(
defineProps<{ defineProps<{
text?: string;
copy?: string | null; copy?: string | null;
oneline?: boolean; oneline?: boolean;
}>(), }>(),

View file

@ -1,6 +1,18 @@
<template> <template>
<a
v-if="to"
class="mention"
:href="to"
rel="noopener"
@click.stop
>
<i class="icon ph-bold ph-large" :class="'ph-' + icon"></i>
<span class="main">
<slot></slot>
</span>
</a>
<MkA <MkA
v-if="url.startsWith('/')" v-else-if="url.startsWith('/')"
v-user-preview="canonical" v-user-preview="canonical"
class="mention" class="mention"
:class="{ isMe }" :class="{ isMe }"
@ -40,21 +52,25 @@ import { host as localHost } from "@/config";
import { $i } from "@/account"; import { $i } from "@/account";
const props = defineProps<{ const props = defineProps<{
username: string; username?: string;
host: string; host?: string;
to?: string;
icon?: string;
}>(); }>();
const canonical = const canonical =
props.host === localHost props.host ?
? `@${props.username}` props.host === localHost
: `@${props.username}@${toUnicode(props.host)}`; ? `@${props.username}`
: `@${props.username}@${toUnicode(props.host)}` : null;
const url = `/${canonical}`; const url = `/${canonical}`;
const isMe = const isMe =
$i && props.username ?
`@${props.username}@${toUnicode(props.host)}` === $i &&
`@${$i.username}@${toUnicode(localHost)}`.toLowerCase(); `@${props.username}@${toUnicode(props.host)}` ===
`@${$i.username}@${toUnicode(localHost)}`.toLowerCase() : null;
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
@ -93,6 +109,12 @@ const isMe =
border-radius: 100%; border-radius: 100%;
} }
> i.icon {
vertical-align: middle;
font-size: 1.2em;
margin-left: .4em;
}
> .main > .host { > .main > .host {
opacity: 0.5; opacity: 0.5;
} }

View file

@ -33,6 +33,7 @@
<MkButton <MkButton
primary gradate primary gradate
rounded rounded
@click="signup"
> >
<i <i
class="ph-sign-in ph-bold" class="ph-sign-in ph-bold"
@ -41,6 +42,7 @@
</MkButton> </MkButton>
<MkButton <MkButton
rounded rounded
@click="signin"
> >
<i <i
class="ph-sign-out ph-bold" class="ph-sign-out ph-bold"
@ -63,6 +65,26 @@
</div> </div>
</section> </section>
<FormSection>
<div class="_formLinksGrid">
<MkKeyValue :text="meta.maintainerName">
<template #key>{{
i18n.ts.administrator
}}</template>
</MkKeyValue>
<MkKeyValue>
<template #key>{{
i18n.ts.contact
}}</template>
<template #value>
<MkMention :to="'mailto:' + meta.maintainerEmail" :icon="'envelope'">
{{ meta.maintainerEmail }}
</MkMention>
</template>
</MkKeyValue>
</div>
</FormSection>
<FormSection> <FormSection>
<div class="_formLinksGrid"> <div class="_formLinksGrid">
<FormLink v-if="meta?.tosUrl" :to="meta.tosUrl" <FormLink v-if="meta?.tosUrl" :to="meta.tosUrl"
@ -135,6 +157,11 @@ import FormLink from "@/components/form/link.vue";
import XShowMoreButton from "@/components/MkShowMoreButton.vue"; import XShowMoreButton from "@/components/MkShowMoreButton.vue";
import { i18n } from "@/i18n"; import { i18n } from "@/i18n";
import { DetailedInstanceMetadata } from "calckey-js/built/entities"; import { DetailedInstanceMetadata } from "calckey-js/built/entities";
import XSigninDialog from "@/components/MkSigninDialog.vue";
import XSignupDialog from "@/components/MkSignupDialog.vue";
import MkKeyValue from "@/components/MkKeyValue.vue";
import MkMention from "@/components/MkMention.vue";
defineProps<{ defineProps<{
poweredBy?: boolean, poweredBy?: boolean,
@ -154,6 +181,27 @@ os.api("meta", { detail: true }).then((res) => {
isLong = meta.description && (meta.description.length > 500); isLong = meta.description && (meta.description.length > 500);
}); });
function signin() {
os.popup(
XSigninDialog,
{
autoSet: true,
},
{},
"closed"
);
};
function signup() {
os.popup(
XSignupDialog,
{
autoSet: true,
},
{},
"closed"
);
};
</script> </script>