Merge remote-tracking branch 'misskey/develop' into develop

This commit is contained in:
ThatOneCalculator 2022-07-24 18:07:18 -07:00
commit 6ece6fb041
8 changed files with 125 additions and 147 deletions

View file

@ -13,7 +13,7 @@ export const meta = {
limit: { limit: {
duration: 60000, duration: 60000,
max: 10, max: 15,
}, },
kind: 'read:notifications', kind: 'read:notifications',

View file

@ -1,5 +1,6 @@
<template> <template>
<button v-if="canRenote" <button
v-if="canRenote"
ref="buttonRef" ref="buttonRef"
class="eddddedb _button canRenote" class="eddddedb _button canRenote"
@click="renote()" @click="renote()"
@ -12,8 +13,9 @@
</button> </button>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { computed, defineComponent, ref } from 'vue'; import { computed, ref } from 'vue';
import * as misskey from 'misskey-js';
import XDetails from '@/components/users-tooltip.vue'; import XDetails from '@/components/users-tooltip.vue';
import { pleaseLogin } from '@/scripts/please-login'; import { pleaseLogin } from '@/scripts/please-login';
import * as os from '@/os'; import * as os from '@/os';
@ -21,71 +23,55 @@ import { $i } from '@/account';
import { useTooltip } from '@/scripts/use-tooltip'; import { useTooltip } from '@/scripts/use-tooltip';
import { i18n } from '@/i18n'; import { i18n } from '@/i18n';
export default defineComponent({ const props = defineProps<{
props: { note: misskey.entities.Note;
count: { count: number;
type: Number, }>();
required: true,
},
note: {
type: Object,
required: true,
},
},
setup(props) { const buttonRef = ref<HTMLElement>();
const buttonRef = ref<HTMLElement>();
const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id); const canRenote = computed(() => ['public', 'home'].includes(props.note.visibility) || props.note.userId === $i.id);
useTooltip(buttonRef, async (showing) => { useTooltip(buttonRef, async (showing) => {
const renotes = await os.api('notes/renotes', { const renotes = await os.api('notes/renotes', {
noteId: props.note.id, noteId: props.note.id,
limit: 11 limit: 11,
}); });
const users = renotes.map(x => x.user); const users = renotes.map(x => x.user);
if (users.length < 1) return; if (users.length < 1) return;
os.popup(XDetails, { os.popup(XDetails, {
showing, showing,
users, users,
count: props.count, count: props.count,
targetElement: buttonRef.value targetElement: buttonRef.value,
}, {}, 'closed'); }, {}, 'closed');
});
const renote = (viaKeyboard = false) => {
pleaseLogin();
os.popupMenu([{
text: i18n.ts.renote,
icon: 'fas fa-retweet',
action: () => {
os.api('notes/create', {
renoteId: props.note.id
});
}
}, {
text: i18n.ts.quote,
icon: 'fas fa-quote-right',
action: () => {
os.post({
renote: props.note,
});
}
}], buttonRef.value, {
viaKeyboard
});
};
return {
buttonRef,
canRenote,
renote,
};
},
}); });
const renote = (viaKeyboard = false) => {
pleaseLogin();
os.popupMenu([{
text: i18n.ts.renote,
icon: 'fas fa-retweet',
action: () => {
os.api('notes/create', {
renoteId: props.note.id,
});
},
}, {
text: i18n.ts.quote,
icon: 'fas fa-quote-right',
action: () => {
os.post({
renote: props.note,
});
},
}], buttonRef.value, {
viaKeyboard,
});
};
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>

View file

@ -63,63 +63,51 @@
</span> </span>
</template> </template>
<script lang="ts"> <script lang="ts" setup>
import { defineComponent, onMounted, onUnmounted, ref } from 'vue'; import { onMounted, onUnmounted, ref } from 'vue';
import * as os from '@/os';
export default defineComponent({ const particles = ref([]);
setup() { const el = ref<HTMLElement>();
const particles = ref([]); const width = ref(0);
const el = ref<HTMLElement>(); const height = ref(0);
const width = ref(0); const colors = ['#eb6f92', '#9ccfd8', '#f6c177', '#f6c177', '#f6c177'];
const height = ref(0); let stop = false;
const colors = ['#eb6f92', '#9ccfd8', '#f6c177', '#f6c177', '#ebbcba']; let ro: ResizeObserver | undefined;
let stop = false;
let ro: ResizeObserver | undefined;
onMounted(() => { onMounted(() => {
ro = new ResizeObserver((entries, observer) => { ro = new ResizeObserver((entries, observer) => {
width.value = el.value?.offsetWidth + 64; width.value = el.value?.offsetWidth + 64;
height.value = el.value?.offsetHeight + 64; height.value = el.value?.offsetHeight + 64;
}); });
ro.observe(el.value); ro.observe(el.value);
const add = () => { const add = () => {
if (stop) return; if (stop) return;
const x = (Math.random() * (width.value - 64)); const x = (Math.random() * (width.value - 64));
const y = (Math.random() * (height.value - 64)); const y = (Math.random() * (height.value - 64));
const sizeFactor = Math.random(); const sizeFactor = Math.random();
const particle = { const particle = {
id: Math.random().toString(), id: Math.random().toString(),
x, x,
y, y,
size: 0.2 + ((sizeFactor / 10) * 3), size: 0.2 + ((sizeFactor / 10) * 3),
dur: 1000 + (sizeFactor * 1000), dur: 1000 + (sizeFactor * 1000),
color: colors[Math.floor(Math.random() * colors.length)], color: colors[Math.floor(Math.random() * colors.length)],
};
particles.value.push(particle);
window.setTimeout(() => {
particles.value = particles.value.filter(x => x.id !== particle.id);
}, particle.dur - 100);
window.setTimeout(() => {
add();
}, 500 + (Math.random() * 500));
};
add();
});
onUnmounted(() => {
if (ro) ro.disconnect();
stop = true;
});
return {
el,
width,
height,
particles,
}; };
}, particles.value.push(particle);
window.setTimeout(() => {
particles.value = particles.value.filter(x => x.id !== particle.id);
}, particle.dur - 100);
window.setTimeout(() => {
add();
}, 500 + (Math.random() * 500));
};
add();
});
onUnmounted(() => {
if (ro) ro.disconnect();
stop = true;
}); });
</script> </script>

View file

@ -18,13 +18,13 @@ export default defineComponent({
disabled: this.modelValue === option.props.value, disabled: this.modelValue === option.props.value,
onClick: () => { onClick: () => {
this.$emit('update:modelValue', option.props.value); this.$emit('update:modelValue', option.props.value);
} },
}, option.children), [ }, option.children), [
[resolveDirective('click-anime')] [resolveDirective('click-anime')],
]))), [ ]))), [
[resolveDirective('size'), { max: [500] }] [resolveDirective('size'), { max: [500] }],
]); ]);
} },
}); });
</script> </script>

View file

@ -141,7 +141,7 @@ export default defineComponent({
display: block; display: block;
min-width: 100px; min-width: 100px;
width: max-content; width: max-content;
padding: 8px 14px; padding: 8px 16px;
text-align: center; text-align: center;
font-weight: normal; font-weight: normal;
font-size: 1em; font-size: 1em;

View file

@ -1,25 +1,24 @@
<template> <template>
<div class=""> <MkStickyContainer>
<section class="_section"> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
<div class="_content"> <MkSpacer :content-max="800">
<XPostForm <XPostForm
v-if="state === 'writing'" v-if="state === 'writing'"
fixed fixed
:instant="true" :instant="true"
:initial-text="initialText" :initial-text="initialText"
:initial-visibility="visibility" :initial-visibility="visibility"
:initial-files="files" :initial-files="files"
:initial-local-only="localOnly" :initial-local-only="localOnly"
:reply="reply" :reply="reply"
:renote="renote" :renote="renote"
:initial-visible-users="visibleUsers" :initial-visible-users="visibleUsers"
class="_panel" class="_panel"
@posted="state = 'posted'" @posted="state = 'posted'"
/> />
<MkButton v-else-if="state === 'posted'" primary class="close" @click="close()">{{ i18n.ts.close }}</MkButton> <MkButton v-else-if="state === 'posted'" primary class="close" @click="close()">{{ i18n.ts.close }}</MkButton>
</div> </MkSpacer>
</section> </MkStickyContainer>
</div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View file

@ -1,7 +1,10 @@
<template> <template>
<div class="_section"> <MkStickyContainer>
<XNotes class="_content" :pagination="pagination"/> <template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
</div> <MkSpacer :content-max="800">
<XNotes class="_content" :pagination="pagination"/>
</MkSpacer>
</MkStickyContainer>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>

View file

@ -70,6 +70,7 @@ import { $i } from '@/account';
import { Router } from '@/nirax'; import { Router } from '@/nirax';
import { mainRouter } from '@/router'; import { mainRouter } from '@/router';
import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata'; import { PageMetadata, provideMetadataReceiver, setPageMetadata } from '@/scripts/page-metadata';
import { deviceKind } from '@/scripts/device-kind';
const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue')); const XWidgets = defineAsyncComponent(() => import('./universal.widgets.vue'));
const XSidebar = defineAsyncComponent(() => import('@/ui/_common_/navbar.vue')); const XSidebar = defineAsyncComponent(() => import('@/ui/_common_/navbar.vue'));
const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue')); const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.vue'));
@ -77,10 +78,11 @@ const XStatusBars = defineAsyncComponent(() => import('@/ui/_common_/statusbars.
const DESKTOP_THRESHOLD = 1100; const DESKTOP_THRESHOLD = 1100;
const MOBILE_THRESHOLD = 500; const MOBILE_THRESHOLD = 500;
// UI deviceKind === 'desktop'
const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD); const isDesktop = ref(window.innerWidth >= DESKTOP_THRESHOLD);
const isMobile = ref(window.innerWidth <= MOBILE_THRESHOLD); const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
window.addEventListener('resize', () => { window.addEventListener('resize', () => {
isMobile.value = window.innerWidth <= MOBILE_THRESHOLD; isMobile.value = deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD;
}); });
let pageMetadata = $ref<null | ComputedRef<PageMetadata>>(); let pageMetadata = $ref<null | ComputedRef<PageMetadata>>();