Skip to content

Commit

Permalink
Merge pull request #35 from NguyenNguyen205/Issue28-Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Villy-P authored Nov 9, 2024
2 parents 624d7be + 1b9f48b commit 4e7f298
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions src/App.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@
let textareavalue: string; // The value for UI Element of the text box for ignore folders
let isFile: boolean = true; // Whether or not the graph shows number of files with extension or size of files
let fileOfType: string[]; // List of files that match the clicked element
let areFiles: boolean;
onMount(() => {
// Getting data from the VSCode backend, found in src/extension.ts
window.addEventListener("message", (e) => {
Expand Down Expand Up @@ -130,7 +131,10 @@
readFileAndChildren(directory.children!);
const extensionsSort = new Map([...fileData.entries()].sort((a, b) => b[1] - a[1]));
// Check if files exist
areFiles = extensionsSort.size > 0;
chart.data = {
labels: Array.from(extensionsSort.keys()).map(e => JSON.parse(e).name + " File"),
datasets: [{
Expand Down Expand Up @@ -162,10 +166,14 @@

<main class="flex flex-col justify-center items-start h-full">
<h1 class="main-header font-bold py-2">File Makeup for {cwd}</h1>
<Dropdown>
<Option on:click={() => {isFile = true; update()}}>Display File Count</Option>
<Option on:click={() => {isFile = false; update()}}>Display Byte Count</Option>
</Dropdown>
{#if !areFiles}
<h2 id="empty"> No files were found in the directory {cwd} </h2>
{:else}
<Dropdown id="displayOption">
<Option on:click={() => {isFile = true; update()}}>Display File Count</Option>
<Option on:click={() => {isFile = false; update()}}>Display Byte Count</Option>
</Dropdown>
{/if}
<div style="width: 700px; height: 700px;">
<canvas id="myChart" role="img"></canvas>
</div>
Expand Down

0 comments on commit 4e7f298

Please sign in to comment.