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
2 changes: 1 addition & 1 deletion frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
rel="stylesheet"
href="https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,400..800;1,9..40,400&display=swap"
href="https://fonts.googleapis.com/css2?family=Manrope:wght@400;500;600;700;800&display=swap"
/>
</head>
<body>
Expand Down
45 changes: 45 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
},
"dependencies": {
"axios": "^1.7.9",
"framer-motion": "^14.1.0",
"lucide-react": "^0.468.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
Expand Down
199 changes: 138 additions & 61 deletions frontend/src/App.jsx

Large diffs are not rendered by default.

22 changes: 22 additions & 0 deletions frontend/src/animations.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const ease = [0.22, 1, 0.36, 1];

export const fadeUp = {
hidden: { opacity: 0, y: 16 },
visible: { opacity: 1, y: 0, transition: { duration: 0.5, ease } },
};

export const staggerContainer = {
hidden: {},
visible: { transition: { staggerChildren: 0.08, delayChildren: 0.05 } },
};

export const maskReveal = {
hidden: { y: '110%' },
visible: { y: '0%', transition: { duration: 0.7, ease } },
};

export const viewTransition = {
hidden: { opacity: 0 },
visible: { opacity: 1, transition: { duration: 0.3 } },
exit: { opacity: 0, transition: { duration: 0.2 } },
};
10 changes: 8 additions & 2 deletions frontend/src/components/GapPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@ import { Check, Link as LinkIcon } from 'lucide-react';
import Card from './ui/Card';
import StepHeading from './ui/StepHeading';
import ProbabilityBar from './ui/ProbabilityBar';
import { useReveal } from '../hooks/useReveal';

// coverage_pct is a 0–1 share; tolerate a 0–100 value too.
const toShare = (v) => (v > 1 ? v / 100 : v || 0);

export default function GapPanel({ recommendations = [], probability = 0, role, className = '' }) {
const before = Math.round(probability * 100);
const recs = recommendations.slice(0, 5);
const [ref, isRevealed] = useReveal({ threshold: 0.1 });

return (
<Card tone="plain" className={className} aria-labelledby="gap-heading">
<Card ref={ref} tone="plain" className={`${className} animate-fade-in-up`} aria-labelledby="gap-heading">
<StepHeading n="02" id="gap-heading" className="mb-1.5">
What should I learn next?
</StepHeading>
Expand All @@ -26,7 +28,11 @@ export default function GapPanel({ recommendations = [], probability = 0, role,
const share = toShare(rec.coverage_pct);
const partners = Array.isArray(rec.learn_with) ? rec.learn_with : (rec.learn_with ? [rec.learn_with] : []);
return (
<li key={rec.skill} className="grid grid-cols-[30px_minmax(0,1fr)] gap-x-3 border-b border-line pb-5 pt-[18px]">
<li
key={rec.skill}
className={`grid grid-cols-[30px_minmax(0,1fr)] gap-x-3 border-b border-line pb-5 pt-[18px] transition-all duration-500 ease-out ${isRevealed ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-3'}`}
style={{ transitionDelay: `${i * 100}ms` }}
>
<span className="pt-[3px] text-sm font-medium tabular-nums text-accent-ink">{String(i + 1).padStart(2, '0')}</span>
<div className="min-w-0">
<div className="flex flex-wrap items-baseline justify-between gap-x-4 gap-y-1">
Expand Down
28 changes: 22 additions & 6 deletions frontend/src/components/MatchPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,29 @@ import { ArrowRight, Check } from 'lucide-react';
import Card from './ui/Card';
import StepHeading from './ui/StepHeading';
import ProbabilityBar from './ui/ProbabilityBar';
import { useReveal } from '../hooks/useReveal';
import { useCountUp } from '../hooks/useCountUp';

const formatPct = (p) => (p < 0.01 ? '<1%' : `${Math.round(p * 100)}%`);
function AnimatedPercent({ probability }) {
const [ref, isRevealed] = useReveal({ threshold: 0 });
const pct = Math.round(probability * 100);
const animatedPct = useCountUp(isRevealed ? pct : 0, 1000);
return (
<span ref={ref} className="text-[28px] font-bold leading-none tracking-[-0.03em] tabular-nums text-fit">
{probability < 0.01 ? '<1%' : `${animatedPct}%`}
</span>
);
}

export default function MatchPanel({ matches = [], desiredRole, onSwitchRole, className = '' }) {
const top = matches.slice(0, 3);
const chosenInTop = top.some((m) => m.role === desiredRole);
const best = top[0]?.role;
const notTopMatch = best && best !== desiredRole;
const [ref, isRevealed] = useReveal({ threshold: 0.1 });

return (
<Card tone="fit" className={className} aria-labelledby="match-heading">
<Card ref={ref} tone="fit" className={`${className} animate-fade-in-up [animation-delay:150ms]`} aria-labelledby="match-heading">
<StepHeading n="03" id="match-heading" className="mb-[18px]">
Which roles fit me right now?
</StepHeading>
Expand All @@ -30,10 +42,10 @@ export default function MatchPanel({ matches = [], desiredRole, onSwitchRole, cl
<button
type="button"
onClick={() => onSwitchRole(best)}
className="inline-flex min-h-11 items-center gap-2 border border-fit bg-surface px-3.5 text-left text-sm font-semibold text-fit-ink hover:bg-bg"
className="group inline-flex min-h-11 items-center gap-2 border border-fit bg-surface px-3.5 text-left text-sm font-semibold text-fit-ink transition-all duration-200 hover:-translate-y-[1px] hover:shadow-sm active:scale-[0.98]"
>
<span>Check readiness for {best}</span>
<ArrowRight size={15} strokeWidth={2.2} className="flex-none" aria-hidden="true" />
<ArrowRight size={15} strokeWidth={2.2} className="flex-none transition-transform duration-200 group-hover:translate-x-1" aria-hidden="true" />
</button>
)}
</div>
Expand All @@ -51,7 +63,11 @@ export default function MatchPanel({ matches = [], desiredRole, onSwitchRole, cl
{top.map((m, i) => {
const isPick = m.role === desiredRole;
return (
<li key={m.role} className="grid grid-cols-[24px_minmax(0,1fr)] gap-x-2.5 border-b border-line py-5">
<li
key={m.role}
className={`grid grid-cols-[24px_minmax(0,1fr)] gap-x-2.5 border-b border-line py-5 transition-all duration-500 ease-out ${isRevealed ? 'opacity-100 translate-y-0' : 'opacity-0 translate-y-3'}`}
style={{ transitionDelay: `${i * 100}ms` }}
>
<span className="pt-1 text-sm tabular-nums text-fit-ink">{i + 1}</span>
<div className="min-w-0">
<div className="flex items-baseline justify-between gap-3">
Expand All @@ -64,7 +80,7 @@ export default function MatchPanel({ matches = [], desiredRole, onSwitchRole, cl
</span>
)}
</span>
<span className="text-[28px] font-bold leading-none tracking-[-0.03em] tabular-nums text-fit">{formatPct(m.probability)}</span>
<AnimatedPercent probability={m.probability} />
</div>
<ProbabilityBar value={m.probability} minPercent={0.6} size="h-[5px]" track="bg-fit-track" fill="bg-fit" className="mt-3.5" />
</div>
Expand Down
16 changes: 11 additions & 5 deletions frontend/src/components/ReadinessPanel.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import Card from './ui/Card';
import StepHeading from './ui/StepHeading';
import ProbabilityBar from './ui/ProbabilityBar';
import { CoveredChip } from './ui/Chip';
import { useReveal } from '../hooks/useReveal';
import { useCountUp } from '../hooks/useCountUp';

const BAND_CUTOFFS = {
close: 0.3,
Expand Down Expand Up @@ -82,16 +84,20 @@ export default function ReadinessPanel({ readiness, role }) {

const [msgA, msgB, msgC] = band.message(role);

const [ref, isRevealed] = useReveal({ threshold: 0.1 });
const animatedPct = useCountUp(isRevealed ? pct : 0, 1000);
const animatedCoveragePct = useCountUp(isRevealed ? coveragePct : 0, 1000);

return (
<Card tone="readiness" aria-labelledby="readiness-heading">
<Card ref={ref} tone="readiness" aria-labelledby="readiness-heading" className="animate-fade-in-up">
<StepHeading n="01" id="readiness-heading" className="mb-6">
Am I ready for {role}?
</StepHeading>

<div className="flex flex-wrap items-end justify-between gap-x-10 gap-y-6">
<div className="flex-[0_1_auto]">
<p className="text-[clamp(88px,23vw,156px)] font-bold leading-[0.86] tracking-[-0.06em] tabular-nums">
{pct}
{animatedPct}
<span className="tracking-[-0.04em]">%</span>
<span className="sr-only"> readiness</span>
</p>
Expand All @@ -114,8 +120,8 @@ export default function ReadinessPanel({ readiness, role }) {
{msgC}
</p>
<div aria-hidden="true">
<div className="relative h-2 bg-line-2">
<div className={`absolute inset-y-0 left-0 ${band.fill}`} style={{ width: `${pct}%` }} />
<div className="relative h-2 bg-line-2 overflow-hidden">
<div className={`absolute inset-y-0 left-0 ${band.fill} transition-[width] duration-1000 ease-out`} style={{ width: isRevealed ? `${pct}%` : '0%' }} />
<span className="absolute bottom-[-3px] top-[-3px] w-[3px] bg-tint" style={{ left: `${BAND_CUTOFFS.close * 100}%` }} />
<span className="absolute bottom-[-3px] top-[-3px] w-[3px] bg-tint" style={{ left: `${BAND_CUTOFFS.ready * 100}%` }} />
</div>
Expand All @@ -139,7 +145,7 @@ export default function ReadinessPanel({ readiness, role }) {
</span>
<span className="text-[15px] text-ink-2">core skills covered</span>
</div>
<span className="text-[15px] font-semibold tabular-nums text-accent-ink">{coveragePct}% coverage</span>
<span className="text-[15px] font-semibold tabular-nums text-accent-ink">{animatedCoveragePct}% coverage</span>
</div>
<ProbabilityBar value={coverage} size="h-2" track="bg-accent-track" fill="bg-accent" />
<p className="mb-3 mt-3.5 text-[15px] text-ink-2">
Expand Down
19 changes: 10 additions & 9 deletions frontend/src/components/RoleSelect.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ export default function RoleSelect({ roles, status, value, onChange, selectedNam
return (
<section className="min-w-0">
<fieldset className="m-0 min-w-0 border-0 p-0" aria-busy={!ready}>
<legend className="mb-5 flex items-center gap-3 p-0 text-[13px] font-bold uppercase tracking-[0.12em] text-ink-2">
<legend className="mb-5 flex items-center gap-3 p-0 text-[14px] font-bold uppercase tracking-[1.5px] text-ink">
<StepNumber n="02" />
Role you're aiming for
</legend>

<div className="border-t border-line-2">
<div className="flex flex-col gap-3">
{!ready && (
<>
<span className="sr-only">{status === 'error' ? 'Roles could not be loaded.' : 'Loading roles…'}</span>
Expand All @@ -37,25 +37,26 @@ export default function RoleSelect({ roles, status, value, onChange, selectedNam
)}

{ready &&
roles.map((role) => {
roles.map((role, i) => {
const checked = role.role_family === value;
const hits = role.top_skills.filter((s) => have.has(s)).length;
const roleInputId = `role-opt-${role.role_family.toLowerCase().replace(/[^a-z0-9]/g, '-')}`;
return (
<label
key={role.role_family}
htmlFor={roleInputId}
className={`flex min-h-[52px] cursor-pointer items-center gap-4 border-b border-line py-4 pr-3 transition-colors ${
checked ? 'bg-accent-tint pl-4 shadow-[inset_3px_0_0_var(--color-accent)]' : 'pl-0 hover:bg-tint'
className={`flex min-h-[72px] cursor-pointer items-center gap-4 rounded-xl border p-4 transition-all duration-300 hover:-translate-y-[1px] hover:border-accent hover:shadow-sm animate-fade-in-up opacity-0 [animation-fill-mode:both] ${
checked ? 'border-accent bg-accent-tint shadow-[0_2px_8px_-2px_rgba(23,128,79,0.15)]' : 'border-line bg-surface'
}`}
style={{ animationDelay: `${350 + Math.min(i, 5) * 50}ms` }}
>
<span className="min-w-0 flex-1">
<span className="block text-[17px] font-semibold tracking-[-0.01em]">{role.role_family}</span>
<span className="mt-[3px] block text-[13px] text-ink-3 [overflow-wrap:anywhere]">
<span className="block text-[17px] font-bold">{role.role_family}</span>
<span className="mt-1 block text-[14px] font-medium text-ink-3 [overflow-wrap:anywhere]">
{role.n_postings.toLocaleString('en-IN')} postings · {role.top_skills.slice(0, 3).join(' · ')}
</span>
{checked && (
<span className="mt-2 block text-[13px] font-medium text-accent-ink">
<span className="mt-2 block text-[14px] font-semibold text-accent-ink">
{selectedNames.length
? `You have ${hits} of the ${role.top_skills.length} skills it usually asks for.`
: `Usually asks for ${role.top_skills.length} core skills.`}
Expand All @@ -69,7 +70,7 @@ export default function RoleSelect({ roles, status, value, onChange, selectedNam
value={role.role_family}
checked={checked}
onChange={() => onChange(role.role_family)}
className="m-0 size-[22px] flex-none cursor-pointer accent-accent"
className="m-0 size-5 flex-none cursor-pointer accent-accent transition-all duration-300"
/>
</label>
);
Expand Down
6 changes: 3 additions & 3 deletions frontend/src/components/SkillInput.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export default function SkillInput({ value, onChange, inputId = 'skill-search' }

<div className="mb-5 flex items-center gap-3">
<StepNumber n="01" />
<label htmlFor={inputId} className="flex-1 text-[13px] font-bold uppercase tracking-[0.12em] text-ink-2">
<label htmlFor={inputId} className="flex-1 text-[14px] font-bold uppercase tracking-[1.5px] text-ink">
Skills you already have
</label>
{value.length > 0 && (
Expand Down Expand Up @@ -222,7 +222,7 @@ export default function SkillInput({ value, onChange, inputId = 'skill-search' }
onFocus={() => setOpen(true)}
onBlur={() => setTimeout(() => setOpen(false), 120)}
onKeyDown={onKeyDown}
className="min-h-[54px] w-full rounded-none border border-line-2 bg-surface py-3 pl-[46px] pr-3.5 text-base text-ink focus:border-accent"
className="min-h-[64px] w-full rounded-xl border border-line bg-surface py-3 pl-[50px] pr-4 text-[17px] font-medium text-ink transition-colors focus:border-accent focus:outline-none focus:ring-1 focus:ring-accent"
/>

{listOpen && (
Expand All @@ -231,7 +231,7 @@ export default function SkillInput({ value, onChange, inputId = 'skill-search' }
id={listId}
role="listbox"
aria-label="Matching skills"
className="absolute inset-x-0 top-[calc(100%-1px)] z-30 max-h-[336px] overflow-auto border border-accent bg-surface shadow-card"
className="absolute inset-x-0 top-[calc(100%+8px)] z-30 max-h-[336px] overflow-auto rounded-xl border border-line bg-surface shadow-card animate-fade-in-up [animation-duration:200ms]"
>
{options.length === 0 && searchStatus === 'loading' && (
<li role="presentation" className="px-4 py-3 text-sm text-ink-3">
Expand Down
12 changes: 9 additions & 3 deletions frontend/src/components/ui/Card.jsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import { forwardRef } from 'react';

const TONES = {
readiness: 'border-t-4 border-t-accent bg-tint p-[clamp(20px,4.5vw,40px)]',
plain: 'bg-surface p-[clamp(20px,4.5vw,36px)]',
Expand All @@ -8,10 +10,14 @@ const TONES = {
notice: 'border-t-[3px] border-t-ink-3 bg-tint px-[clamp(18px,4vw,28px)] py-[22px]',
};

export default function Card({ as: Tag = 'section', tone = 'plain', shadow = true, className = '', children, ...rest }) {
const Card = forwardRef(function Card({ as: Tag = 'section', tone = 'plain', shadow = true, className = '', children, ...rest }, ref) {
return (
<Tag className={`min-w-0 border border-line ${TONES[tone] || TONES.plain} ${shadow ? 'shadow-card' : ''} ${className}`} {...rest}>
<Tag ref={ref} className={`min-w-0 border border-line ${TONES[tone] || TONES.plain} ${shadow ? 'shadow-card' : ''} ${className}`} {...rest}>
{children}
</Tag>
);
}
});

Card.displayName = 'Card';

export default Card;
Loading
Loading