Merge branch 'develop' into post-form-uploader
This commit is contained in:
		
						commit
						490e0a7382
					
				|  | @ -7,7 +7,10 @@ SPDX-License-Identifier: AGPL-3.0-only | |||
| <div v-if="!store.r.tips.value[props.k]" :class="[$style.root, { [$style.warn]: warn }]" class="_selectable _gaps_s"> | ||||
| 	<div style="font-weight: bold;"><i class="ti ti-bulb"></i> {{ i18n.ts.tip }}:</div> | ||||
| 	<div><slot></slot></div> | ||||
| 	<MkButton primary rounded small @click="closeTip()"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton> | ||||
| 	<div> | ||||
| 		<MkButton inline primary rounded small @click="_closeTip()"><i class="ti ti-check"></i> {{ i18n.ts.gotIt }}</MkButton> | ||||
| 		<button class="_button" style="padding: 8px; margin-left: 4px;" @click="showMenu"><i class="ti ti-dots"></i></button> | ||||
| 	</div> | ||||
| </div> | ||||
| </template> | ||||
| 
 | ||||
|  | @ -15,19 +18,30 @@ SPDX-License-Identifier: AGPL-3.0-only | |||
| import { i18n } from '@/i18n.js'; | ||||
| import { store } from '@/store.js'; | ||||
| import MkButton from '@/components/MkButton.vue'; | ||||
| import * as os from '@/os.js'; | ||||
| import { TIPS, hideAllTips, closeTip } from '@/tips.js'; | ||||
| 
 | ||||
| const props = withDefaults(defineProps<{ | ||||
| 	k: keyof (typeof store['s']['tips']); | ||||
| 	k: typeof TIPS[number]; | ||||
| 	warn?: boolean; | ||||
| }>(), { | ||||
| 	warn: false, | ||||
| }); | ||||
| 
 | ||||
| function closeTip() { | ||||
| 	store.set('tips', { | ||||
| 		...store.r.tips.value, | ||||
| 		[props.k]: true, | ||||
| 	}); | ||||
| function _closeTip() { | ||||
| 	closeTip(props.k); | ||||
| } | ||||
| 
 | ||||
| function showMenu(ev: MouseEvent) { | ||||
| 	os.popupMenu([{ | ||||
| 		icon: 'ti ti-bulb-off', | ||||
| 		text: i18n.ts.hideAllTips, | ||||
| 		danger: true, | ||||
| 		action: () => { | ||||
| 			hideAllTips(); | ||||
| 			os.success(); | ||||
| 		}, | ||||
| 	}], ev.currentTarget ?? ev.target); | ||||
| } | ||||
| </script> | ||||
| 
 | ||||
|  |  | |||
|  | @ -161,7 +161,7 @@ import { prefer } from '@/preferences.js'; | |||
| import MkRolePreview from '@/components/MkRolePreview.vue'; | ||||
| import { signout } from '@/signout.js'; | ||||
| import { migrateOldSettings } from '@/pref-migrate.js'; | ||||
| import { store, TIPS } from '@/store.js'; | ||||
| import { hideAllTips as _hideAllTips, resetAllTips as _resetAllTips } from '@/tips.js'; | ||||
| 
 | ||||
| const $i = ensureSignin(); | ||||
| 
 | ||||
|  | @ -205,16 +205,12 @@ function migrate() { | |||
| } | ||||
| 
 | ||||
| function resetAllTips() { | ||||
| 	store.set('tips', {}); | ||||
| 	_resetAllTips(); | ||||
| 	os.success(); | ||||
| } | ||||
| 
 | ||||
| function hideAllTips() { | ||||
| 	const v = {}; | ||||
| 	for (const k of TIPS) { | ||||
| 		v[k] = true; | ||||
| 	} | ||||
| 	store.set('tips', v); | ||||
| 	_hideAllTips(); | ||||
| 	os.success(); | ||||
| } | ||||
| 
 | ||||
|  |  | |||
|  | @ -10,23 +10,11 @@ import darkTheme from '@@/themes/d-green-lime.json5'; | |||
| import { hemisphere } from '@@/js/intl-const.js'; | ||||
| import type { DeviceKind } from '@/utility/device-kind.js'; | ||||
| import type { Plugin } from '@/plugin.js'; | ||||
| import type { TIPS } from '@/tips.js'; | ||||
| import { miLocalStorage } from '@/local-storage.js'; | ||||
| import { Pizzax } from '@/lib/pizzax.js'; | ||||
| import { DEFAULT_DEVICE_KIND } from '@/utility/device-kind.js'; | ||||
| 
 | ||||
| export const TIPS = [ | ||||
| 	'drive', | ||||
| 	'uploader', | ||||
| 	'postFormUploader', | ||||
| 	'clips', | ||||
| 	'userLists', | ||||
| 	'tl.home', | ||||
| 	'tl.local', | ||||
| 	'tl.social', | ||||
| 	'tl.global', | ||||
| 	'abuses', | ||||
| ] as const; | ||||
| 
 | ||||
| /** | ||||
|  * 「状態」を管理するストア(not「設定」) | ||||
|  */ | ||||
|  |  | |||
|  | @ -0,0 +1,37 @@ | |||
| /* | ||||
|  * SPDX-FileCopyrightText: syuilo and misskey-project | ||||
|  * SPDX-License-Identifier: AGPL-3.0-only | ||||
|  */ | ||||
| 
 | ||||
| import { store } from '@/store.js'; | ||||
| 
 | ||||
| export const TIPS = [ | ||||
| 	'drive', | ||||
| 	'uploader', | ||||
| 	'clips', | ||||
| 	'userLists', | ||||
| 	'tl.home', | ||||
| 	'tl.local', | ||||
| 	'tl.social', | ||||
| 	'tl.global', | ||||
| 	'abuses', | ||||
| ] as const; | ||||
| 
 | ||||
| export function closeTip(tip: typeof TIPS[number]) { | ||||
| 	store.set('tips', { | ||||
| 		...store.r.tips.value, | ||||
| 		[tip]: true, | ||||
| 	}); | ||||
| } | ||||
| 
 | ||||
| export function resetAllTips() { | ||||
| 	store.set('tips', {}); | ||||
| } | ||||
| 
 | ||||
| export function hideAllTips() { | ||||
| 	const v = {}; | ||||
| 	for (const k of TIPS) { | ||||
| 		v[k] = true; | ||||
| 	} | ||||
| 	store.set('tips', v); | ||||
| } | ||||
		Loading…
	
		Reference in New Issue