mirror of
				https://github.com/Lissy93/dashy.git
				synced 2025-10-31 19:33:58 +01:00 
			
		
		
		
	🚧 Basic structure for widgets
This commit is contained in:
		
							parent
							
								
									6b4fbfe25b
								
							
						
					
					
						commit
						490c8e73fa
					
				
							
								
								
									
										52
									
								
								src/components/Widgets/WidgetBase.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										52
									
								
								src/components/Widgets/WidgetBase.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,52 @@ | |||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |   <Collapsable | ||||||
|  |     :title="widget.name" | ||||||
|  |     :icon="widget.icon" | ||||||
|  |     :uniqueKey="groupId" | ||||||
|  |     :collapsed="displayData.collapsed" | ||||||
|  |     :cols="displayData.cols" | ||||||
|  |     :rows="displayData.rows" | ||||||
|  |     :color="displayData.color" | ||||||
|  |     :customStyles="displayData.customStyles" | ||||||
|  |   > | ||||||
|  |   <Clock v-if="widgetType === 'clock'" :options="widgetOptions" /> | ||||||
|  |   </Collapsable> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import Clock from '@/components/Widgets/Clock.vue'; | ||||||
|  | import Collapsable from '@/components/LinkItems/Collapsable.vue'; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: 'Widget', | ||||||
|  |   components: { | ||||||
|  |     Collapsable, | ||||||
|  |     Clock, | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     widget: Object, | ||||||
|  |     index: Number, | ||||||
|  |   }, | ||||||
|  |   computed: { | ||||||
|  |     displayData() { | ||||||
|  |       return this.widget.displayData || {}; | ||||||
|  |     }, | ||||||
|  |     groupId() { | ||||||
|  |       return `widget-${this.index}`; | ||||||
|  |     }, | ||||||
|  |     widgetType() { | ||||||
|  |       return this.widget.type.toLowerCase(); | ||||||
|  |     }, | ||||||
|  |     widgetOptions() { | ||||||
|  |       return this.widget.options || {}; | ||||||
|  |     }, | ||||||
|  |   }, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style scoped lang="scss"> | ||||||
|  | @import '@/styles/media-queries.scss'; | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
							
								
								
									
										30
									
								
								src/components/Widgets/WidgetGroup.vue
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										30
									
								
								src/components/Widgets/WidgetGroup.vue
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,30 @@ | |||||||
|  | <template> | ||||||
|  |   <div> | ||||||
|  |     <WidgetBase | ||||||
|  |       v-for="(widget, widgetIndex) in widgets" | ||||||
|  |       :key="widgetIndex" | ||||||
|  |       :widget="widget" | ||||||
|  |       :index="widgetIndex" | ||||||
|  |     /> | ||||||
|  |   </div> | ||||||
|  | </template> | ||||||
|  | 
 | ||||||
|  | <script> | ||||||
|  | import WidgetBase from '@/components/Widgets/WidgetBase'; | ||||||
|  | 
 | ||||||
|  | export default { | ||||||
|  |   name: 'WidgetGroup', | ||||||
|  |   components: { | ||||||
|  |     WidgetBase, | ||||||
|  |   }, | ||||||
|  |   props: { | ||||||
|  |     widgets: Array, | ||||||
|  |   }, | ||||||
|  |   computed: {}, | ||||||
|  | }; | ||||||
|  | </script> | ||||||
|  | 
 | ||||||
|  | <style scoped lang="scss"> | ||||||
|  | @import '@/styles/media-queries.scss'; | ||||||
|  | 
 | ||||||
|  | </style> | ||||||
| @ -27,6 +27,8 @@ | |||||||
|         + (singleSectionView ? 'single-section-view ' : '') |         + (singleSectionView ? 'single-section-view ' : '') | ||||||
|         + (this.colCount ? `col-count-${this.colCount} ` : '')" |         + (this.colCount ? `col-count-${this.colCount} ` : '')" | ||||||
|       > |       > | ||||||
|  |       <!-- Display any dynamic widget content --> | ||||||
|  |       <WidgetGroup v-if="!singleSectionView" :widgets="widgets" /> | ||||||
|       <Section |       <Section | ||||||
|         v-for="(section, index) in filteredTiles" |         v-for="(section, index) in filteredTiles" | ||||||
|         :key="index" |         :key="index" | ||||||
| @ -61,6 +63,7 @@ | |||||||
| 
 | 
 | ||||||
| import SettingsContainer from '@/components/Settings/SettingsContainer.vue'; | import SettingsContainer from '@/components/Settings/SettingsContainer.vue'; | ||||||
| import Section from '@/components/LinkItems/Section.vue'; | import Section from '@/components/LinkItems/Section.vue'; | ||||||
|  | import WidgetGroup from '@/components/Widgets/WidgetGroup'; | ||||||
| import EditModeSaveMenu from '@/components/InteractiveEditor/EditModeSaveMenu.vue'; | import EditModeSaveMenu from '@/components/InteractiveEditor/EditModeSaveMenu.vue'; | ||||||
| import ExportConfigMenu from '@/components/InteractiveEditor/ExportConfigMenu.vue'; | import ExportConfigMenu from '@/components/InteractiveEditor/ExportConfigMenu.vue'; | ||||||
| import AddNewSection from '@/components/InteractiveEditor/AddNewSectionLauncher.vue'; | import AddNewSection from '@/components/InteractiveEditor/AddNewSectionLauncher.vue'; | ||||||
| @ -74,6 +77,7 @@ export default { | |||||||
|   name: 'home', |   name: 'home', | ||||||
|   components: { |   components: { | ||||||
|     SettingsContainer, |     SettingsContainer, | ||||||
|  |     WidgetGroup, | ||||||
|     EditModeSaveMenu, |     EditModeSaveMenu, | ||||||
|     ExportConfigMenu, |     ExportConfigMenu, | ||||||
|     AddNewSection, |     AddNewSection, | ||||||
| @ -96,6 +100,9 @@ export default { | |||||||
|     pageInfo() { |     pageInfo() { | ||||||
|       return this.$store.getters.pageInfo; |       return this.$store.getters.pageInfo; | ||||||
|     }, |     }, | ||||||
|  |     widgets() { | ||||||
|  |       return this.$store.getters.widgets; | ||||||
|  |     }, | ||||||
|     modalOpen() { |     modalOpen() { | ||||||
|       return this.$store.state.modalOpen; |       return this.$store.state.modalOpen; | ||||||
|     }, |     }, | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user