added icon

This commit is contained in:
dhruvik7
2021-02-21 17:10:04 -05:00
parent 2587ff5820
commit d8eee206c7
4 changed files with 9 additions and 16 deletions

View File

@@ -1,24 +1,13 @@
import * as React from "react";
import ReactCalendarHeatmap from "react-calendar-heatmap";
import ReactTooltip from "react-tooltip";
import { MAX_COLORS, COLOR_FREQ } from "./constants";
interface HeatmapProps {
data: any[];
}
const MAX_COLORS = 5;
const COLOR_FREQ = 6;
class Heatmap extends React.Component<HeatmapProps> {
componentDidMount() {
ReactTooltip.rebuild();
}
componentDidUpdate() {
ReactTooltip.rebuild();
}
render() {
const customTooltipDataAttrs = (value: any) => ({
'data-tip': value.date === null ? '' : value.count + ' on ' + new Date(value.date).toLocaleDateString()

View File

@@ -1 +1,3 @@
export const VIEW_TYPE_STATS_TRACKER = "stats-tracker";
export const MAX_COLORS = 5;
export const COLOR_FREQ = 6;

View File

@@ -1,4 +1,4 @@
import { TFile, Plugin, MarkdownView, debounce, Debouncer, WorkspaceLeaf } from 'obsidian';
import { TFile, Plugin, MarkdownView, debounce, Debouncer, WorkspaceLeaf, addIcon } from 'obsidian';
import { VIEW_TYPE_STATS_TRACKER } from './constants';
import StatsTrackerView from './view';
@@ -73,6 +73,8 @@ export default class DailyStats extends Plugin {
}, 200)
);
addIcon("bar-graph", `<path fill="currentColor" stroke="currentColor" d="M122.88,105.98H9.59v-0.02c-2.65,0-5.05-1.08-6.78-2.81c-1.72-1.72-2.79-4.11-2.79-6.75H0V0h12.26v93.73h110.62V105.98 L122.88,105.98z M83.37,45.6h19.55c1.04,0,1.89,0.85,1.89,1.89v38.46c0,1.04-0.85,1.89-1.89,1.89H83.37 c-1.04,0-1.89-0.85-1.89-1.89V47.5C81.48,46.46,82.33,45.6,83.37,45.6L83.37,45.6z M25.36,22.07h19.55c1.04,0,1.89,0.85,1.89,1.89 v62c0,1.04-0.85,1.89-1.89,1.89H25.36c-1.04,0-1.89-0.85-1.89-1.89v-62C23.47,22.92,24.32,22.07,25.36,22.07L25.36,22.07 L25.36,22.07z M54.37,8.83h19.54c1.04,0,1.89,0.85,1.89,1.89v75.24c0,1.04-0.85,1.89-1.89,1.89H54.37c-1.04,0-1.89-0.85-1.89-1.89 V10.72C52.48,9.68,53.33,8.83,54.37,8.83L54.37,8.83z"/>`);
this.registerInterval(window.setInterval(() => {
this.updateDate();
this.saveSettings();

View File

@@ -28,7 +28,7 @@ export default class StatsTrackerView extends ItemView {
}
getIcon() {
return "calendar-with-checkmark";
return "bar-graph";
}
getViewType() {