mirror of
				https://codeberg.org/yeentown/barkey.git
				synced 2025-11-03 23:14:13 +00:00 
			
		
		
		
	add DynamicNote to encapsulate MkNote / SkNote switching logic
This commit is contained in:
		
							parent
							
								
									cea77f3e2c
								
							
						
					
					
						commit
						9e833f724b
					
				
					 1 changed files with 49 additions and 0 deletions
				
			
		
							
								
								
									
										49
									
								
								packages/frontend/src/components/DynamicNote.vue
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										49
									
								
								packages/frontend/src/components/DynamicNote.vue
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,49 @@
 | 
			
		|||
<!--
 | 
			
		||||
SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
 | 
			
		||||
SPDX-License-Identifier: AGPL-3.0-only
 | 
			
		||||
-->
 | 
			
		||||
 | 
			
		||||
<template>
 | 
			
		||||
<XNote
 | 
			
		||||
	ref="rootEl"
 | 
			
		||||
	:note="note"
 | 
			
		||||
	:pinned="pinned"
 | 
			
		||||
	:mock="mock"
 | 
			
		||||
	:withHardMute="withHardMute"
 | 
			
		||||
	@reaction="emoji => emit('reaction', emoji)"
 | 
			
		||||
	@removeReaction="emoji => emit('removeReaction', emoji)"
 | 
			
		||||
/>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script setup lang="ts">
 | 
			
		||||
import * as Misskey from 'misskey-js';
 | 
			
		||||
import { computed, defineAsyncComponent, shallowRef } from 'vue';
 | 
			
		||||
import type { ComponentExposed } from 'vue-component-type-helpers';
 | 
			
		||||
import type MkNote from '@/components/MkNote.vue';
 | 
			
		||||
import type SkNote from '@/components/SkNote.vue';
 | 
			
		||||
import { defaultStore } from '@/store';
 | 
			
		||||
 | 
			
		||||
const XNote = computed(() =>
 | 
			
		||||
	defineAsyncComponent(() =>
 | 
			
		||||
		defaultStore.reactiveState.noteDesign.value === 'misskey'
 | 
			
		||||
			? import('@/components/MkNote.vue')
 | 
			
		||||
			: import('@/components/SkNote.vue'),
 | 
			
		||||
	),
 | 
			
		||||
);
 | 
			
		||||
 | 
			
		||||
const rootEl = shallowRef<ComponentExposed<typeof MkNote | typeof SkNote>>();
 | 
			
		||||
 | 
			
		||||
defineExpose({ rootEl });
 | 
			
		||||
 | 
			
		||||
defineProps<{
 | 
			
		||||
	note: Misskey.entities.Note;
 | 
			
		||||
	pinned?: boolean;
 | 
			
		||||
	mock?: boolean;
 | 
			
		||||
	withHardMute?: boolean;
 | 
			
		||||
}>();
 | 
			
		||||
 | 
			
		||||
const emit = defineEmits<{
 | 
			
		||||
	(ev: 'reaction', emoji: string): void;
 | 
			
		||||
	(ev: 'removeReaction', emoji: string): void;
 | 
			
		||||
}>();
 | 
			
		||||
</script>
 | 
			
		||||
		Loading…
	
	Add table
		
		Reference in a new issue