topmatter: refactor

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/653/head
Varun Patil 2023-04-28 22:13:32 -07:00
parent 281e431965
commit e1986b6991
1 changed files with 19 additions and 5 deletions

View File

@ -1,9 +1,6 @@
<template> <template>
<div class="top-matter-container" v-if="type"> <div class="top-matter-container" v-if="currentmatter">
<FolderTopMatter v-if="type === 1" /> <component :is="currentmatter" />
<ClusterTopMatter v-else-if="type === 2" />
<FaceTopMatter v-else-if="type === 3" />
<AlbumTopMatter v-else-if="type === 4" />
</div> </div>
</template> </template>
@ -40,6 +37,23 @@ export default defineComponent({
this.setTopMatter(); this.setTopMatter();
}, },
computed: {
currentmatter() {
switch (this.type) {
case TopMatterType.FOLDER:
return FolderTopMatter;
case TopMatterType.ALBUM:
return AlbumTopMatter;
case TopMatterType.CLUSTER:
return ClusterTopMatter;
case TopMatterType.FACE:
return FaceTopMatter;
default:
return null;
}
},
},
methods: { methods: {
/** Create top matter */ /** Create top matter */
setTopMatter() { setTopMatter() {