MCPcopy Create free account
hub / github.com/callumalpass/tasknotes / renderFilters

Method renderFilters

src/views/StatsView.ts:824–912  ·  view source on GitHub ↗

* Render filter controls

()

Source from the content-addressed store, hash-verified

822 * Render filter controls
823 */
824 private renderFilters() {
825 if (!this.filtersEl) return;
826
827 this.filtersEl.empty();
828
829 // Create filter container with grid layout
830 const filterGrid = this.filtersEl.createDiv({ cls: "stats-view__filter-grid" });
831
832 // Date range filter
833 const dateRangeContainer = filterGrid.createDiv({ cls: "stats-view__filter-item" });
834 const dateRangeLabel = dateRangeContainer.createDiv({ cls: "stats-view__filter-label" });
835 dateRangeLabel.textContent = this.plugin.i18n.translate("views.stats.sections.dateRange");
836
837 const dateRangeSelect = dateRangeContainer.createEl("select", {
838 cls: "stats-view__filter-select",
839 });
840 const dateOptions = [
841 { value: "all", text: this.plugin.i18n.translate("views.stats.timeRanges.allTime") },
842 {
843 value: "7days",
844 text: this.plugin.i18n.translate("views.stats.timeRanges.last7Days"),
845 },
846 {
847 value: "30days",
848 text: this.plugin.i18n.translate("views.stats.timeRanges.last30Days"),
849 },
850 {
851 value: "90days",
852 text: this.plugin.i18n.translate("views.stats.timeRanges.last90Days"),
853 },
854 {
855 value: "custom",
856 text: this.plugin.i18n.translate("views.stats.timeRanges.customRange"),
857 },
858 ];
859
860 for (const option of dateOptions) {
861 const optionEl = dateRangeSelect.createEl("option", {
862 value: option.value,
863 text: option.text,
864 });
865 if (option.value === this.currentFilters.dateRange) {
866 optionEl.selected = true;
867 }
868 }
869
870 this.registerDomEvent(dateRangeSelect, "change", () => {
871 this.currentFilters.dateRange = dateRangeSelect.value as StatsFilters["dateRange"];
872 this.renderCustomDateInputs();
873 void this.applyFilters();
874 });
875
876 // Custom date inputs container
877 const customDatesContainer = filterGrid.createDiv({ cls: "stats-view__custom-dates" });
878 if (this.currentFilters.dateRange === "custom") {
879 this.renderCustomDateInputs(customDatesContainer);
880 }
881

Callers 1

renderMethod · 0.95

Calls 5

applyFiltersMethod · 0.95
translateMethod · 0.65
toStringMethod · 0.65

Tested by

no test coverage detected