mirror of
				https://github.com/advplyr/audiobookshelf.git
				synced 2025-10-27 11:18:14 +01:00 
			
		
		
		
	Update:Library config page for mobile #753 and style updates
This commit is contained in:
		
							parent
							
								
									d90bd92bcc
								
							
						
					
					
						commit
						806a8cf659
					
				| @ -4,7 +4,7 @@ | ||||
|       <span class="material-icons text-2xl">arrow_back</span> | ||||
|     </div> | ||||
| 
 | ||||
|     <nuxt-link v-for="route in configRoutes" :key="route.id" :to="route.path" class="w-full px-4 h-12 border-b border-opacity-0 flex items-center cursor-pointer relative" :class="routeName === route.id ? 'bg-primary bg-opacity-70' : 'hover:bg-primary hover:bg-opacity-30'"> | ||||
|     <nuxt-link v-for="route in configRoutes" :key="route.id" :to="route.path" class="w-full px-4 h-12 border-b border-primary border-opacity-30 flex items-center cursor-pointer relative" :class="routeName === route.id ? 'bg-primary bg-opacity-70' : 'hover:bg-primary hover:bg-opacity-30'"> | ||||
|       <p>{{ route.title }}</p> | ||||
|       <div v-show="routeName === route.iod" class="h-full w-0.5 bg-yellow-400 absolute top-0 left-0" /> | ||||
|     </nuxt-link> | ||||
|  | ||||
							
								
								
									
										56
									
								
								client/components/modals/Dialog.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										56
									
								
								client/components/modals/Dialog.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,56 @@ | ||||
| <template> | ||||
|   <modals-modal v-model="show" :width="300" height="100%"> | ||||
|     <template #outer> | ||||
|       <div v-if="title" class="absolute top-7 left-4 z-40" style="max-width: 80%"> | ||||
|         <p class="text-white text-lg truncate">{{ title }}</p> | ||||
|       </div> | ||||
|     </template> | ||||
| 
 | ||||
|     <div class="w-full h-full overflow-hidden absolute top-0 left-0 flex items-center justify-center" @click="show = false"> | ||||
|       <div ref="container" class="w-full overflow-x-hidden overflow-y-auto bg-primary rounded-lg border border-white border-opacity-20" style="max-height: 75%" @click.stop> | ||||
|         <ul class="h-full w-full" role="listbox" aria-labelledby="listbox-label"> | ||||
|           <template v-for="item in items"> | ||||
|             <li :key="item.value" class="text-gray-50 select-none relative py-4 cursor-pointer hover:bg-black-400" :class="selected === item.value ? 'bg-success bg-opacity-10' : ''" role="option" @click="clickedOption(item.value)"> | ||||
|               <div class="relative flex items-center px-3"> | ||||
|                 <p class="font-normal block truncate text-base text-white text-opacity-80">{{ item.text }}</p> | ||||
|               </div> | ||||
|             </li> | ||||
|           </template> | ||||
|         </ul> | ||||
|       </div> | ||||
|     </div> | ||||
|   </modals-modal> | ||||
| </template> | ||||
| 
 | ||||
| <script> | ||||
| export default { | ||||
|   props: { | ||||
|     value: Boolean, | ||||
|     title: String, | ||||
|     items: { | ||||
|       type: Array, | ||||
|       default: () => [] | ||||
|     }, | ||||
|     selected: String // optional | ||||
|   }, | ||||
|   data() { | ||||
|     return {} | ||||
|   }, | ||||
|   computed: { | ||||
|     show: { | ||||
|       get() { | ||||
|         return this.value | ||||
|       }, | ||||
|       set(val) { | ||||
|         this.$emit('input', val) | ||||
|       } | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     clickedOption(action) { | ||||
|       this.$emit('action', action) | ||||
|     } | ||||
|   }, | ||||
|   mounted() {} | ||||
| } | ||||
| </script> | ||||
| @ -5,7 +5,7 @@ | ||||
|         <p class="font-book text-3xl text-white truncate">Session {{ _session.id }}</p> | ||||
|       </div> | ||||
|     </template> | ||||
|     <div ref="container" class="w-full rounded-lg bg-primary box-shadow-md overflow-y-auto overflow-x-hidden p-6" style="max-height: 80vh"> | ||||
|     <div ref="container" class="w-full rounded-lg bg-bg box-shadow-md overflow-y-auto overflow-x-hidden p-6" style="max-height: 80vh"> | ||||
|       <div class="flex items-center"> | ||||
|         <p class="text-base text-gray-200">{{ _session.displayTitle }}</p> | ||||
|         <p v-if="_session.displayAuthor" class="text-xs text-gray-400 px-4">by {{ _session.displayAuthor }}</p> | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|   <div id="heatmap" class="w-full"> | ||||
|     <div class="mx-auto" :style="{ height: innerHeight + 160 + 'px', width: innerWidth + 52 + 'px' }" style="background-color: rgba(13, 17, 23, 0)"> | ||||
|       <p class="mb-2 px-1 text-sm text-gray-200">{{ Object.values(daysListening).length }} listening sessions in the last year</p> | ||||
|       <div class="border border-opacity-25 rounded py-2 w-full" style="background-color: #232323" :style="{ height: innerHeight + 80 + 'px' }"> | ||||
|       <div class="border border-white border-opacity-25 rounded py-2 w-full" style="background-color: #232323" :style="{ height: innerHeight + 80 + 'px' }"> | ||||
|         <div :style="{ width: innerWidth + 'px', height: innerHeight + 'px' }" class="ml-10 mt-5 absolute" @mouseover="mouseover" @mouseout="mouseout"> | ||||
|           <div v-for="dayLabel in dayLabels" :key="dayLabel.label" :style="dayLabel.style" class="absolute top-0 left-0 text-gray-300">{{ dayLabel.label }}</div> | ||||
| 
 | ||||
|  | ||||
| @ -9,7 +9,7 @@ | ||||
|     <draggable v-if="libraryCopies.length" :list="libraryCopies" v-bind="dragOptions" class="list-group" draggable=".item" tag="div" @start="startDrag" @end="endDrag"> | ||||
|       <template v-for="library in libraryCopies"> | ||||
|         <div :key="library.id" class="item"> | ||||
|           <tables-library-item :library="library" :selected="currentLibraryId === library.id" :show-edit="true" :dragging="drag" @edit="editLibrary" @click="setLibrary" /> | ||||
|           <tables-library-item :library="library" :selected="currentLibraryId === library.id" :dragging="drag" @edit="editLibrary" @click="setLibrary" /> | ||||
|         </div> | ||||
|       </template> | ||||
|     </draggable> | ||||
|  | ||||
| @ -7,19 +7,26 @@ | ||||
|     </svg> | ||||
|     <p class="text-xl font-book pl-4 hover:underline cursor-pointer" @click.stop="$emit('click', library)">{{ library.name }}</p> | ||||
|     <div class="flex-grow" /> | ||||
|     <ui-btn v-show="isHovering && !libraryScan" small color="success" @click.stop="scan">Scan</ui-btn> | ||||
|     <ui-btn v-show="isHovering && !libraryScan" small color="bg" class="ml-2" @click.stop="forceScan">Force Re-Scan</ui-btn> | ||||
|     <ui-btn v-show="isHovering && !libraryScan" class="hidden md:block" small color="success" @click.stop="scan">Scan</ui-btn> | ||||
|     <ui-btn v-show="isHovering && !libraryScan" small color="bg" class="ml-2 hidden md:block" @click.stop="forceScan">Force Re-Scan</ui-btn> | ||||
| 
 | ||||
|     <ui-btn v-show="isHovering && !libraryScan && isBookLibrary" small color="bg" class="ml-2" @click.stop="matchAll">Match Books</ui-btn> | ||||
|     <ui-btn v-show="isHovering && !libraryScan && isBookLibrary" small color="bg" class="ml-2 hidden md:block" @click.stop="matchAll">Match Books</ui-btn> | ||||
| 
 | ||||
|     <span v-show="isHovering && !libraryScan && showEdit" class="material-icons text-xl text-gray-300 hover:text-gray-50 ml-4 cursor-pointer" @click.stop="editClick">edit</span> | ||||
|     <span v-show="!libraryScan && isHovering && showEdit && !isDeleting" class="material-icons text-xl text-gray-300 ml-3" :class="isMain ? 'text-opacity-5 cursor-not-allowed' : 'hover:text-gray-50 cursor-pointer'" @click.stop="deleteClick">delete</span> | ||||
|     <span v-if="isHovering && !libraryScan" class="!hidden md:!block material-icons text-xl text-gray-300 hover:text-gray-50 ml-4 cursor-pointer" @click.stop="editClick">edit</span> | ||||
|     <span v-if="!libraryScan && isHovering && !isDeleting" class="!hidden md:!block material-icons text-xl text-gray-300 ml-3 hover:text-gray-50 cursor-pointer" @click.stop="deleteClick">delete</span> | ||||
| 
 | ||||
|     <!-- For mobile --> | ||||
|     <span v-if="!libraryScan" class="!block md:!hidden material-icons text-xl text-gray-300 ml-4 cursor-pointer" @click.stop="editClick">edit</span> | ||||
|     <span v-if="!libraryScan && !isDeleting" class="!block md:!hidden material-icons text-2xl text-gray-300 ml-3 cursor-pointer" @click.stop="showMenu">more_vert</span> | ||||
|     <div v-show="isDeleting" class="text-xl text-gray-300 ml-3 animate-spin"> | ||||
|       <svg viewBox="0 0 24 24" class="w-6 h-6"> | ||||
|         <path fill="currentColor" d="M12,4V2A10,10 0 0,0 2,12H4A8,8 0 0,1 12,4Z" /> | ||||
|       </svg> | ||||
|     </div> | ||||
|     <span class="material-icons text-xxl text-gray-300 hover:text-gray-50 ml-4 cursor-pointer">reorder</span> | ||||
|     <span class="material-icons text-xl text-gray-400 hover:text-gray-50 ml-4">reorder</span> | ||||
| 
 | ||||
|     <!-- For mobile --> | ||||
|     <modals-dialog v-model="showMobileMenu" :title="menuTitle" :items="mobileMenuItems" @action="mobileMenuAction" /> | ||||
|   </div> | ||||
| </template> | ||||
| 
 | ||||
| @ -31,22 +38,19 @@ export default { | ||||
|       default: () => {} | ||||
|     }, | ||||
|     selected: Boolean, | ||||
|     showEdit: Boolean, | ||||
|     dragging: Boolean | ||||
|   }, | ||||
|   data() { | ||||
|     return { | ||||
|       mouseover: false, | ||||
|       isDeleting: false | ||||
|       isDeleting: false, | ||||
|       showMobileMenu: false | ||||
|     } | ||||
|   }, | ||||
|   computed: { | ||||
|     isHovering() { | ||||
|       return this.mouseover && !this.dragging | ||||
|     }, | ||||
|     isMain() { | ||||
|       return this.library.id === 'main' | ||||
|     }, | ||||
|     libraryScan() { | ||||
|       return this.$store.getters['scanners/getLibraryScan'](this.library.id) | ||||
|     }, | ||||
| @ -55,9 +59,50 @@ export default { | ||||
|     }, | ||||
|     isBookLibrary() { | ||||
|       return this.mediaType === 'book' | ||||
|     }, | ||||
|     menuTitle() { | ||||
|       return this.library.name | ||||
|     }, | ||||
|     mobileMenuItems() { | ||||
|       const items = [ | ||||
|         { | ||||
|           text: 'Scan', | ||||
|           value: 'scan' | ||||
|         }, | ||||
|         { | ||||
|           text: 'Force Re-Scan', | ||||
|           value: 'force-scan' | ||||
|         } | ||||
|       ] | ||||
|       if (this.isBookLibrary) { | ||||
|         items.push({ | ||||
|           text: 'Match Books', | ||||
|           value: 'match-books' | ||||
|         }) | ||||
|       } | ||||
|       items.push({ | ||||
|         text: 'Delete', | ||||
|         value: 'delete' | ||||
|       }) | ||||
|       return items | ||||
|     } | ||||
|   }, | ||||
|   methods: { | ||||
|     mobileMenuAction(action) { | ||||
|       this.showMobileMenu = false | ||||
|       if (action === 'scan') { | ||||
|         this.scan() | ||||
|       } else if (action === 'force-scan') { | ||||
|         this.forceScan() | ||||
|       } else if (action === 'match-books') { | ||||
|         this.matchAll() | ||||
|       } else if (action === 'delete') { | ||||
|         this.deleteClick() | ||||
|       } | ||||
|     }, | ||||
|     showMenu() { | ||||
|       this.showMobileMenu = true | ||||
|     }, | ||||
|     matchAll() { | ||||
|       this.$axios | ||||
|         .$post(`/api/libraries/${this.library.id}/matchall`) | ||||
| @ -98,7 +143,6 @@ export default { | ||||
|       } | ||||
|     }, | ||||
|     deleteClick() { | ||||
|       if (this.isMain) return | ||||
|       if (confirm(`Are you sure you want to permanently delete library "${this.library.name}"?`)) { | ||||
|         this.isDeleting = true | ||||
|         this.$axios | ||||
|  | ||||
		Loading…
	
		Reference in New Issue
	
	Block a user