fix notification-setting-window.vue
This commit is contained in:
		
							parent
							
								
									929dc076ec
								
							
						
					
					
						commit
						c67c0df762
					
				
					 1 changed files with 8 additions and 7 deletions
				
			
		|  | @ -21,14 +21,14 @@ | ||||||
| 			<MkInfo>{{ i18n.ts.notificationSettingDesc }}</MkInfo> | 			<MkInfo>{{ i18n.ts.notificationSettingDesc }}</MkInfo> | ||||||
| 			<MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton> | 			<MkButton inline @click="disableAll">{{ i18n.ts.disableAll }}</MkButton> | ||||||
| 			<MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton> | 			<MkButton inline @click="enableAll">{{ i18n.ts.enableAll }}</MkButton> | ||||||
| 			<MkSwitch v-for="type in notificationTypes" :key="type" v-model="typesMap[type]">{{ i18n.t(`_notification._types.${type}`) }}</MkSwitch> | 			<MkSwitch v-for="ntype in notificationTypes" :key="ntype" v-model="typesMap[ntype]">{{ i18n.t(`_notification._types.${ntype}`) }}</MkSwitch> | ||||||
| 		</div> | 		</div> | ||||||
| 	</div> | 	</div> | ||||||
| </XModalWindow> | </XModalWindow> | ||||||
| </template> | </template> | ||||||
| 
 | 
 | ||||||
| <script lang="ts" setup> | <script lang="ts" setup> | ||||||
| import { PropType } from 'vue'; | import { } from 'vue'; | ||||||
| import { notificationTypes } from 'misskey-js'; | import { notificationTypes } from 'misskey-js'; | ||||||
| import MkSwitch from './form/switch.vue'; | import MkSwitch from './form/switch.vue'; | ||||||
| import MkInfo from './ui/info.vue'; | import MkInfo from './ui/info.vue'; | ||||||
|  | @ -42,21 +42,22 @@ const emit = defineEmits<{ | ||||||
| }>(); | }>(); | ||||||
| 
 | 
 | ||||||
| const props = withDefaults(defineProps<{ | const props = withDefaults(defineProps<{ | ||||||
| 	// TODO: これで型に合わないものを弾いてくれるのかどうか要調査 | 	includingTypes?: typeof notificationTypes[number][] | null; | ||||||
| 	includingTypes?: typeof notificationTypes[number][]; |  | ||||||
| 	showGlobalToggle?: boolean; | 	showGlobalToggle?: boolean; | ||||||
| }>(), { | }>(), { | ||||||
| 	includingTypes: () => [], | 	includingTypes: () => [], | ||||||
| 	showGlobalToggle: true, | 	showGlobalToggle: true, | ||||||
| }); | }); | ||||||
| 
 | 
 | ||||||
|  | let includingTypes = $computed(() => props.includingTypes || []); | ||||||
|  | 
 | ||||||
| const dialog = $ref<InstanceType<typeof XModalWindow>>(); | const dialog = $ref<InstanceType<typeof XModalWindow>>(); | ||||||
| 
 | 
 | ||||||
| let typesMap = $ref<Record<typeof notificationTypes[number], boolean>>({}); | let typesMap = $ref<Record<typeof notificationTypes[number], boolean>>({}); | ||||||
| let useGlobalSetting = $ref(props.includingTypes === [] && props.showGlobalToggle); | let useGlobalSetting = $ref((includingTypes === null || includingTypes.length === 0) && props.showGlobalToggle); | ||||||
| 
 | 
 | ||||||
| for (const type of notificationTypes) { | for (const ntype of notificationTypes) { | ||||||
| 	typesMap[type] = props.includingTypes.includes(type); | 	typesMap[ntype] = includingTypes.includes(ntype); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function ok() { | function ok() { | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue