Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix no file in directory bug #35

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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