Skip to content
Merged
Show file tree
Hide file tree
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
66 changes: 30 additions & 36 deletions src/lib/components/scoring/ScoreDashboard.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import KeywordAnalysis from './KeywordAnalysis.svelte';
import WeakestAreas from './WeakestAreas.svelte';
import ResumeStats from './ResumeStats.svelte';
import ShareBadge from './ShareBadge.svelte';
import type { Suggestion, StructuredSuggestion } from '$engine/scorer/types';

// derived stats for the summary card header
Expand All @@ -14,6 +15,7 @@

// toggle between grid cards and detailed breakdown view
let activeView = $state<'cards' | 'detailed'>('cards');
let showShareBadge = $state(false);

// collapsible suggestion cards
let expandedSuggestion = $state<number | null>(null);
Expand Down Expand Up @@ -49,25 +51,6 @@
return suggestions.slice(0, 5);
});

// exports results as a JSON file download
function exportResults() {
const data = {
exportedAt: new Date().toISOString(),
mode: scoresStore.mode,
averageScore: avgScore,
passingCount: passCount,
totalSystems: totalCount,
results: scoresStore.results
};
const blob = new Blob([JSON.stringify(data, null, 2)], { type: 'application/json' });
const url = URL.createObjectURL(blob);
const a = document.createElement('a');
a.href = url;
a.download = `ats-scores-${new Date().toISOString().slice(0, 10)}.json`;
a.click();
URL.revokeObjectURL(url);
}

// color based on average score
function getAvgColor(score: number): string {
if (score >= 80) return '#22c55e';
Expand Down Expand Up @@ -281,21 +264,25 @@
</button>
</div>

<button class="export-btn" onclick={exportResults} title="Export results as JSON">
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
>
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" />
<polyline points="7,10 12,15 17,10" />
<line x1="12" y1="15" x2="12" y2="3" />
</svg>
Export
</button>
<div class="toolbar-actions">
<button class="toolbar-btn" onclick={() => (showShareBadge = true)} title="Share score badge">
<svg
width="16"
height="16"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
stroke-width="2"
>
<circle cx="18" cy="5" r="3" />
<circle cx="6" cy="12" r="3" />
<circle cx="18" cy="19" r="3" />
<line x1="8.59" y1="13.51" x2="15.42" y2="17.49" />
<line x1="15.41" y1="6.51" x2="8.59" y2="10.49" />
</svg>
Share
</button>
</div>
</div>

<!-- card view: 6 ATS score cards in a grid -->
Expand Down Expand Up @@ -423,6 +410,8 @@
</div>
{/if}

<ShareBadge bind:open={showShareBadge} />

<style>
.dashboard {
margin-top: 2rem;
Expand Down Expand Up @@ -669,7 +658,12 @@
gap: 1rem;
}

.export-btn {
.toolbar-actions {
display: flex;
gap: 0.5rem;
}

.toolbar-btn {
display: inline-flex;
align-items: center;
gap: 0.4rem;
Expand All @@ -688,7 +682,7 @@
background 0.2s ease;
}

.export-btn:hover {
.toolbar-btn:hover {
border-color: rgba(6, 182, 212, 0.3);
color: var(--accent-cyan);
background: rgba(6, 182, 212, 0.05);
Expand Down
Loading
Loading