Skip to content

Commit a77d8b1

Browse files
committed
feat: show the uploaded file name next to the header
- Added fileName property in core.js to track uploaded file names. - Updated index.html to improve UI with new links and styles. - Adjusted button sizes for better accessibility and usability.
1 parent 167ad24 commit a77d8b1

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

src/core.js

+3
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ document.addEventListener("alpine:init", () => {
1212
supportedSources: ["Git", "Github"],
1313
source: undefined,
1414
sampleDataURL: "https://static.truffleshow.dev/github-sample.json",
15+
fileName: null,
1516

1617
init() { },
1718

@@ -21,6 +22,7 @@ document.addEventListener("alpine:init", () => {
2122

2223
this.isLoading = true;
2324
this.error = null;
25+
this.fileName = file.name;
2426

2527
const reader = new FileReader();
2628
reader.onload = (e) => {
@@ -61,6 +63,7 @@ document.addEventListener("alpine:init", () => {
6163
fetch(this.sampleDataURL)
6264
.then((response) => response.text())
6365
.then((data) => {
66+
this.fileName = "github-sample.json";
6467
this.loadFile(data);
6568
})
6669
.catch((error) => {

src/index.html

+18-9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!doctype html>
2-
<html lang="en">
2+
<html lang="en" class="dark">
33

44
<head>
55
<meta charset="UTF-8" />
@@ -26,9 +26,17 @@
2626
<div x-data="TruffleShowApp" class="container mx-auto py-8 px-4">
2727
<h1 class="text-3xl font-bold text-center mb-8 text-gray-800 dark:text-white">
2828
<i class="fas fa-file-shield text-teal-600 dark:text-teal-400 mr-2"></i>
29-
TruffleShow
29+
<a href="/" class="hover:dark:text-gray-300">
30+
TruffleShow
31+
</a>
3032
<p class="text-sm text-center text-gray-600 dark:text-gray-400 mt-2">
31-
v0.3.0 <!--x-release-please-version-->
33+
<a href="https://github.com/alioguzhan/truffleshow/blob/main/CHANGELOG.md" target="_blank"
34+
class="hover:dark:text-gray-200">
35+
v0.3.0 <!--x-release-please-version-->
36+
</a>
37+
<a href="https://github.com/alioguzhan/truffleshow" target="_blank" class="ml-2 hover:dark:text-gray-200">
38+
<i class="fab fa-github mr-2"></i>
39+
</a>
3240
</p>
3341
</h1>
3442
<p class="text-center text-gray-600 dark:text-gray-100 mb-2">
@@ -42,7 +50,7 @@ <h1 class="text-3xl font-bold text-center mb-8 text-gray-800 dark:text-white">
4250
<div x-show="!isFileUploaded"
4351
class="max-w-lg mx-auto bg-white dark:bg-gray-800 rounded-lg shadow-md p-8 dark-transition">
4452
<h2 class="text-xl font-semibold mb-4 text-gray-700 dark:text-gray-200 text-center">
45-
<i class="fas fa-upload text-teal-500 dark:text-teal-400 mr-2"></i>
53+
<i class="fas fa-file-upload text-teal-500 dark:text-teal-400 mr-2"></i>
4654
Upload TruffleHog JSON Output
4755
</h2>
4856

@@ -107,11 +115,12 @@ <h2 class="text-xl font-semibold mb-4 text-gray-700 dark:text-gray-200 text-cent
107115
<div x-cloak x-show="isFileUploaded" class="bg-white dark:bg-gray-800 rounded-lg shadow-md p-6 dark-transition">
108116
<div class="flex justify-between items-center mb-6">
109117
<h2 class="text-2xl font-semibold text-gray-800 dark:text-white">
110-
<i class="fas fa-list-check text-teal-600 dark:text-teal-400 mr-2"></i>TruffleHog Findings
118+
<i class="fas fa-list-check text-teal-600 dark:text-teal-400 mr-1"></i>Findings
119+
<span class="text-sm dark:text-gray-400 font-normal" x-text="fileName"></span>
111120
</h2>
112121
<div class="flex items-center space-x-2">
113-
<button @click="generateReport"
114-
class="px-4 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded hover:bg-blue-700 dark:hover:bg-blue-600 transition flex items-center">
122+
<button @click="generateReport" class="px-2 py-2 bg-blue-600 dark:bg-blue-700 text-white rounded hover:bg-blue-700
123+
dark:hover:bg-blue-600 transition flex items-center text-sm">
115124
<template x-if="!isGeneratingReport">
116125
<i class="fas fa-file-pdf mr-1"></i>
117126
</template>
@@ -120,8 +129,8 @@ <h2 class="text-2xl font-semibold text-gray-800 dark:text-white">
120129
</template>
121130
<span x-text="isGeneratingReport ? 'Generating PDF...' : 'Download PDF (Beta)'"></span>
122131
</button>
123-
<button @click="resetApp"
124-
class="px-4 py-2 bg-teal-600 dark:bg-teal-700 text-white rounded hover:bg-teal-700 dark:hover:bg-teal-600 transition">
132+
<button @click="resetApp" class="px-2 py-2 bg-teal-600 dark:bg-teal-700 text-white rounded hover:bg-teal-700 dark:hover:bg-teal-600
133+
transition text-sm">
125134
<i class="fas fa-upload mr-2"></i>Upload Another File
126135
</button>
127136
</div>

0 commit comments

Comments
 (0)