mirror of https://github.com/usememos/memos.git
chore(lint): fix formatting and import order
This commit is contained in:
parent
f6b95056a3
commit
12505a0a93
|
|
@ -1,3 +1,4 @@
|
|||
import dayjs from "dayjs";
|
||||
import { memo, useMemo } from "react";
|
||||
import { useInstance } from "@/contexts/InstanceContext";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
|
@ -7,7 +8,6 @@ import { useTodayDate, useWeekdayLabels } from "./hooks";
|
|||
import type { CalendarSize, MonthCalendarProps } from "./types";
|
||||
import { useCalendarMatrix } from "./useCalendar";
|
||||
import { getTooltipText } from "./utils";
|
||||
import dayjs from "dayjs";
|
||||
|
||||
const GRID_STYLES: Record<CalendarSize, { gap: string; headerText: string }> = {
|
||||
small: { gap: "gap-1.5", headerText: "text-[10px]" },
|
||||
|
|
@ -42,10 +42,9 @@ export const MonthCalendar = memo((props: MonthCalendarProps) => {
|
|||
const today = useTodayDate();
|
||||
const weekDays = useWeekdayLabels();
|
||||
const selectedDateFormatted = useMemo(() => {
|
||||
if (!selectedDate) return null;
|
||||
return dayjs(selectedDate).format("YYYY-MM-DD");
|
||||
}, [selectedDate]);
|
||||
|
||||
if (!selectedDate) return null;
|
||||
return dayjs(selectedDate).format("YYYY-MM-DD");
|
||||
}, [selectedDate]);
|
||||
|
||||
const { weeks, weekDays: rotatedWeekDays } = useCalendarMatrix({
|
||||
month,
|
||||
|
|
|
|||
|
|
@ -79,7 +79,15 @@ interface MonthCardProps {
|
|||
const MonthCard = memo(({ month, data, maxCount, onDateClick, selectedDate }: MonthCardProps) => (
|
||||
<article className="flex flex-col gap-2 rounded-xl border border-border/20 bg-muted/5 p-3 transition-colors hover:bg-muted/10">
|
||||
<header className="text-[10px] font-medium text-muted-foreground/80 uppercase tracking-widest">{getMonthLabel(month)}</header>
|
||||
<MonthCalendar month={month} data={data} maxCount={maxCount} size="small" onClick={onDateClick} selectedDate={selectedDate} disableTooltips />
|
||||
<MonthCalendar
|
||||
month={month}
|
||||
data={data}
|
||||
maxCount={maxCount}
|
||||
size="small"
|
||||
onClick={onDateClick}
|
||||
selectedDate={selectedDate}
|
||||
disableTooltips
|
||||
/>
|
||||
</article>
|
||||
));
|
||||
MonthCard.displayName = "MonthCard";
|
||||
|
|
@ -105,21 +113,11 @@ export const YearCalendar = memo(({ selectedYear, data, onYearChange, onDateClic
|
|||
canGoNext={canGoNext}
|
||||
/>
|
||||
|
||||
<<<<<<< HEAD
|
||||
<div className="grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 animate-fade-in">
|
||||
{months.map((month) => (
|
||||
<MonthCard key={month} month={month} data={yearData} maxCount={yearMaxCount} onDateClick={onDateClick} />
|
||||
<MonthCard key={month} month={month} data={yearData} maxCount={yearMaxCount} onDateClick={onDateClick} selectedDate={null} />
|
||||
))}
|
||||
</div>
|
||||
=======
|
||||
<TooltipProvider>
|
||||
<div className="grid gap-4 grid-cols-1 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4 animate-fade-in">
|
||||
{months.map((month) => (
|
||||
<MonthCard key={month} month={month} data={yearData} maxCount={yearMaxCount} onDateClick={onDateClick} selectedDate={null}/>
|
||||
))}
|
||||
</div>
|
||||
</TooltipProvider>
|
||||
>>>>>>> 48116cde (fix(types): fix TypeScript type errors)
|
||||
</section>
|
||||
);
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
import dayjs from "dayjs";
|
||||
import { useMemo, useState } from "react";
|
||||
import { MonthCalendar } from "@/components/ActivityCalendar";
|
||||
import { type MemoFilter, useMemoFilterContext } from "@/contexts/MemoFilterContext";
|
||||
import type { StatisticsData } from "@/types/statistics";
|
||||
import { MonthNavigator } from "./MonthNavigator";
|
||||
import { type MemoFilter, useMemoFilterContext } from "@/contexts/MemoFilterContext";
|
||||
|
||||
interface Props {
|
||||
statisticsData: StatisticsData;
|
||||
|
|
@ -43,7 +43,13 @@ const StatisticsView = (props: Props) => {
|
|||
<MonthNavigator visibleMonth={visibleMonthString} onMonthChange={setVisibleMonthString} activityStats={activityStats} />
|
||||
|
||||
<div className="w-full animate-scale-in">
|
||||
<MonthCalendar month={visibleMonthString} selectedDate={selectedDate ? selectedDate.toDateString() : null} data={activityStats} maxCount={maxCount} onClick={handleDateCellClick} />
|
||||
<MonthCalendar
|
||||
month={visibleMonthString}
|
||||
selectedDate={selectedDate ? selectedDate.toDateString() : null}
|
||||
data={activityStats}
|
||||
maxCount={maxCount}
|
||||
onClick={handleDateCellClick}
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
|
|
|||
Loading…
Reference in New Issue