mirror of
				https://gitee.com/gitea/gitea
				synced 2025-11-04 00:20:25 +08:00 
			
		
		
		
	Heatmap days clickable (#13935)
* Heatmap days clickable * Error handling * Unselect filter * better dayclick handler * made linter happy * clickable heatmap for profiles Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
		@@ -10,6 +10,7 @@
 | 
			
		||||
      :end-date="endDate"
 | 
			
		||||
      :values="values"
 | 
			
		||||
      :range-color="colorRange"
 | 
			
		||||
      @day-click="handleDayClick($event)"
 | 
			
		||||
    />
 | 
			
		||||
  </div>
 | 
			
		||||
</template>
 | 
			
		||||
@@ -48,7 +49,25 @@ export default {
 | 
			
		||||
      }
 | 
			
		||||
      return s;
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
  },
 | 
			
		||||
  methods: {
 | 
			
		||||
    handleDayClick(e) {
 | 
			
		||||
      // Reset filter if same date is clicked
 | 
			
		||||
      const params = new URLSearchParams(document.location.search);
 | 
			
		||||
      const queryDate = params.get('date');
 | 
			
		||||
      // Timezone has to be stripped because toISOString() converts to UTC
 | 
			
		||||
      const clickedDate = new Date(e.date - (e.date.getTimezoneOffset() * 60000)).toISOString().substring(0, 10);
 | 
			
		||||
 | 
			
		||||
      if (queryDate && queryDate === clickedDate) {
 | 
			
		||||
        params.delete('date');
 | 
			
		||||
      } else {
 | 
			
		||||
        params.set('date', clickedDate);
 | 
			
		||||
      }
 | 
			
		||||
 | 
			
		||||
      const newSearch = params.toString();
 | 
			
		||||
      window.location.search = newSearch.length ? `?${newSearch}` : '';
 | 
			
		||||
    }
 | 
			
		||||
  },
 | 
			
		||||
};
 | 
			
		||||
</script>
 | 
			
		||||
<style scoped/>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user