Skip to content

Commit

Permalink
clean up formatting and remove comments
Browse files Browse the repository at this point in the history
  • Loading branch information
kimmykokonut committed Jul 12, 2024
1 parent 4146e45 commit 69cd112
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 27 deletions.
9 changes: 0 additions & 9 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import StatusPie from "@/components/StatusPie";
import TitleBar from "@/components/TitleBar";
import AddApplication from "@/components/add-application";
import quotes from "./quotes";
import { split } from "postcss/lib/list";
import LineGraph from "@/components/LineGraph";

interface Application {
Expand Down Expand Up @@ -61,12 +60,6 @@ export default function Home() {
}
};



// const dateOptions = { dateStyle: 'long' as const };
// formattedFirstDate = new Intl.DateTimeFormat('en-US', dateOptions).format(date);
// }

function getRandomQuote() {
const randomQuote = quotes[Math.floor(Math.random() * quotes.length)];
setQuote(randomQuote.text);
Expand Down Expand Up @@ -123,8 +116,6 @@ export default function Home() {
</div>

</div>
<p>See data as a boring chart link</p>

</main>
);
}
9 changes: 5 additions & 4 deletions src/components/LineGraph.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,17 @@ interface AppProps {
const LineGraph: React.FC<AppProps> = ({ applicationData }) => {

const getWeekStartDate = (date:Date) => {
const day = date.getDay(); //day of week. 0 = sun
const diff = date.getDate() - day; // diff curr date to last sun
//day of week. 0 = sun
const day = date.getDay();
// diff curr date to last sun
const diff = date.getDate() - day;
return new Date(date.setDate(diff));
};

const applicationsPerWeek = applicationData.reduce<Record<string, number>>((acc, application) => {
const date = new Date(application.Date);
const weekStart = getWeekStartDate(date);
const weekStartKey = weekStart.toISOString().split('T')[0]; //start week as key
const weekStartKey = weekStart.toISOString().split('T')[0];

acc[weekStartKey] = (acc[weekStartKey] || 0) + 1;
return acc;
Expand Down Expand Up @@ -77,7 +79,6 @@ const LineGraph: React.FC<AppProps> = ({ applicationData }) => {
}
}
}

return <Line data={data} options={options} />;
}
export default LineGraph;
14 changes: 2 additions & 12 deletions src/components/StatusPie.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const StatusPie: React.FC<StatusPieProps> = ({ applicationData }) => {
labels: Object.keys(statusCounts),
datasets: [{
data: Object.values(statusCounts),
backgroundColor: ['#7c00ff', '#06b000', '#e6c200', '#0df0df', '#a24aff', '#1166a3'], // 6 status: nope, ghost, interview, takehome, hired, other
backgroundColor: ['#7c00ff', '#06b000', '#e6c200', '#0df0df', '#a24aff', '#1166a3'],
}],
};

Expand All @@ -49,15 +49,6 @@ const StatusPie: React.FC<StatusPieProps> = ({ applicationData }) => {
bottom: 10,
},
},
// legend not displaying?!
// legend: {
// display: true,
// position: 'right' as LayoutPosition,
// labels: {
// boxWidth: 20,
// padding: 10,
// }
// },
datalabels: {
color: '#fff',
anchor: 'end',
Expand All @@ -68,15 +59,14 @@ const StatusPie: React.FC<StatusPieProps> = ({ applicationData }) => {
formatter: (value: number, context: any) => {
const label = context.chart.data.labels[context.dataIndex];
const percent = +(value / totalCount * 100).toFixed(0);
if (percent < 3) return null; // Adjust threshold as needed
if (percent < 3) return null;
return `${label}: ${percent}%`;
},
textStrokeColor: '#000',
textStrokeWidth: 1,
}
}
}

return <Pie data={data} options={options} />;
}
export default StatusPie;
1 change: 0 additions & 1 deletion src/components/TitleBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ const TitleBar: React.FC<AppProps> = ({ applicationData }) => {
}
}
}

return <Bar data={data} options={options} />;
}
export default TitleBar;
1 change: 0 additions & 1 deletion src/components/add-application.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,5 +180,4 @@ export default function AddApplication({ onAddApplication }: AddApplicationProps
</div>
</form>
);

}

0 comments on commit 69cd112

Please sign in to comment.