mirror of
https://github.com/ankitects/anki.git
synced 2025-09-21 07:22:23 -04:00
Add search functionality to Calendar view
This commit is contained in:
parent
f1c8879830
commit
7f671cf837
2 changed files with 9 additions and 0 deletions
|
@ -1,4 +1,5 @@
|
|||
<script lang="typescript">
|
||||
import { createEventDispatcher } from "svelte";
|
||||
import NoDataOverlay from "./NoDataOverlay.svelte";
|
||||
import AxisTicks from "./AxisTicks.svelte";
|
||||
import { defaultGraphBounds, RevlogRange } from "./graph-helpers";
|
||||
|
@ -15,6 +16,8 @@
|
|||
export let nightMode: boolean;
|
||||
|
||||
let { calendarFirstDayOfWeek } = preferences;
|
||||
const dispatch = createEventDispatcher();
|
||||
|
||||
let graphData: GraphData | null = null;
|
||||
|
||||
let bounds = defaultGraphBounds();
|
||||
|
@ -49,6 +52,7 @@
|
|||
svg as SVGElement,
|
||||
bounds,
|
||||
graphData,
|
||||
dispatch,
|
||||
targetYear,
|
||||
i18n,
|
||||
nightMode,
|
||||
|
|
|
@ -82,6 +82,7 @@ export function renderCalendar(
|
|||
svgElem: SVGElement,
|
||||
bounds: GraphBounds,
|
||||
sourceData: GraphData,
|
||||
dispatch: any,
|
||||
targetYear: number,
|
||||
i18n: I18n,
|
||||
nightMode: boolean,
|
||||
|
@ -113,6 +114,7 @@ export function renderCalendar(
|
|||
maxCount = count;
|
||||
}
|
||||
}
|
||||
console.log('sourceData', sourceData, dayMap)
|
||||
|
||||
if (!maxCount) {
|
||||
setDataAvailable(svg, false);
|
||||
|
@ -205,6 +207,9 @@ export function renderCalendar(
|
|||
showTooltip(tooltipText(d), x, y);
|
||||
})
|
||||
.on("mouseout", hideTooltip)
|
||||
.on("click", function (this: any, d: any) {
|
||||
dispatch("search", { query: `"prop:rated=${d.day}"` });
|
||||
})
|
||||
.transition()
|
||||
.duration(800)
|
||||
.attr("fill", (d) => (d.count === 0 ? emptyColour : blues(d.count)!));
|
||||
|
|
Loading…
Reference in a new issue