Skip to content

Commit

Permalink
Update main.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
ericciarla committed May 27, 2024
1 parent 3cf5a04 commit c0972f6
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/components/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

import Menu from "../components/menu";
import Graph from "../components/graph";
import { useRef, useState } from "react";
import { useEffect, useRef, useState } from "react";
import { Theme, allThemes } from "@/lib/theme";
import html2canvas from "html2canvas";
import DataInput from "@/components/data-input";
Expand Down Expand Up @@ -62,7 +62,7 @@ export default function MainComponent() {
const [chartData, setChartData] = useState(initialData);
const [xName, setXName] = useState("Date");
const [yName, setYName] = useState("Stars");
const [padding, setPadding] = useState(window.innerWidth < 450 ? 16 : 32);
const [padding, setPadding] = useState(32);
const [width, setWidth] = useState("400");
const [theme, setTheme] = useState<Theme>(
() => allThemes["firecrawl"] as Theme
Expand All @@ -82,6 +82,12 @@ export default function MainComponent() {
const [maxValue, setMaxValue] = useState(0);
const [finalChartData, setFinalChartData] = useState(chartData);

useEffect(() => {
if (typeof window !== "undefined") {
setPadding(window.innerWidth < 450 ? 16 : 32);
}
}, []);

const handleExport = async (copyAsImage: boolean = false) => {
if (chartRef.current) {
const canvas = await html2canvas(chartRef.current, {
Expand Down Expand Up @@ -129,7 +135,7 @@ export default function MainComponent() {
}}
>
<main className="relative flex h-[95vh] flex-col items-center justify-start bg-transparent bg-opacity-80">
{/* <Button
{/* <Button
onClick={() => {
window.open('https://github.com/mendableai/firecrawl', '_blank');
}}
Expand Down

0 comments on commit c0972f6

Please sign in to comment.