Revert "refactor: 画面サイズのしきい値をconstにまとめる"

This reverts commit 05ca36f400.
This commit is contained in:
kakkokari-gtyih
2024-08-20 15:56:54 +09:00
parent 22f0e1f30e
commit 3971e214f9
9 changed files with 15 additions and 17 deletions

View File

@@ -86,7 +86,6 @@ SPDX-License-Identifier: AGPL-3.0-only
import { defineAsyncComponent, onDeactivated, onUnmounted, ref } from 'vue';
import type { summaly } from '@misskey-dev/summaly';
import { url as local } from '@/config.js';
import { MOBILE_THRESHOLD } from '@/const.js';
import { i18n } from '@/i18n.js';
import * as os from '@/os.js';
import { deviceKind } from '@/scripts/device-kind.js';
@@ -108,6 +107,7 @@ const props = withDefaults(defineProps<{
showActions: true,
});
const MOBILE_THRESHOLD = 500;
const isMobile = ref(deviceKind === 'smartphone' || window.innerWidth <= MOBILE_THRESHOLD);
const self = props.url.startsWith(local);

View File

@@ -48,7 +48,6 @@ import { scrollToTop } from '@/scripts/scroll.js';
import { globalEvents } from '@/events.js';
import { injectReactiveMetadata } from '@/scripts/page-metadata.js';
import { $i, openAccountMenu as openAccountMenu_ } from '@/account.js';
import { MOBILE_THRESHOLD } from '@/const.js';
import { PageHeaderItem } from '@/types/page-header.js';
const props = withDefaults(defineProps<{
@@ -113,10 +112,10 @@ onMounted(() => {
globalEvents.on('themeChanged', calcBg);
if (el.value && el.value.parentElement) {
narrow.value = el.value.parentElement.offsetWidth < MOBILE_THRESHOLD;
narrow.value = el.value.parentElement.offsetWidth < 500;
ro = new ResizeObserver((entries, observer) => {
if (el.value && el.value.parentElement && document.body.contains(el.value as HTMLElement)) {
narrow.value = el.value.parentElement.offsetWidth < MOBILE_THRESHOLD;
narrow.value = el.value.parentElement.offsetWidth < 500;
}
});
ro.observe(el.value.parentElement as HTMLElement);