|
1 | | -import React from 'react'; |
| 1 | +import React, { useState } from 'react'; |
| 2 | +import { HfInference } from '@huggingface/inference'; |
| 3 | + |
| 4 | +const hf = new HfInference('your_huggingface_api_key'); // Replace with your API key |
| 5 | + |
| 6 | +const analyzeResume = async (file) => { |
| 7 | + try { |
| 8 | + const response = await hf.textClassification({ |
| 9 | + model: 'resume-analysis-model', // Replace with an actual model |
| 10 | + inputs: file, |
| 11 | + }); |
| 12 | + return response; |
| 13 | + } catch (error) { |
| 14 | + console.error('Error analyzing resume:', error); |
| 15 | + return null; |
| 16 | + } |
| 17 | +}; |
| 18 | + |
| 19 | +const templates = [ |
| 20 | + { id: 1, name: 'Modern Template', preview: '/templates/modern.png' }, |
| 21 | + { id: 2, name: 'Classic Template', preview: '/templates/classic.png' }, |
| 22 | + { id: 3, name: 'Creative Template', preview: '/templates/creative.png' }, |
| 23 | +]; |
2 | 24 |
|
3 | 25 | const ResumeBuilderPage = () => { |
| 26 | + const [uploadedResume, setUploadedResume] = useState(null); |
| 27 | + const [atsScore, setAtsScore] = useState(null); |
| 28 | + const [suggestions, setSuggestions] = useState([]); |
| 29 | + |
| 30 | + const handleFileUpload = async (event) => { |
| 31 | + const file = event.target.files[0]; |
| 32 | + setUploadedResume(file); |
| 33 | + |
| 34 | + // Placeholder for ATS analysis logic |
| 35 | + const analysisResults = await analyzeResume(file); |
| 36 | + if (analysisResults) { |
| 37 | + setAtsScore(analysisResults.score || 85); // Example score |
| 38 | + setSuggestions( |
| 39 | + analysisResults.suggestions || [ |
| 40 | + 'Add more keywords related to JavaScript', |
| 41 | + 'Improve formatting for ATS readability', |
| 42 | + ], |
| 43 | + ); |
| 44 | + } |
| 45 | + }; |
| 46 | + |
4 | 47 | return ( |
5 | | - <div className="background-wrapper1 min-h-screen bg-gray-900 p-6 text-center text-white"> |
6 | | - <header className="mb-6 w-full rounded-md bg-[#00a6fb] py-4 text-center"> |
7 | | - <h1 className="text-4xl font-bold"> |
8 | | - This is the Resume Builder page - Want to Build this page as a contributor |
9 | | - </h1> |
| 48 | + <div className="min-h-screen bg-gray-900 p-6 text-white"> |
| 49 | + <header className="mb-6 w-full rounded-md bg-blue-600 py-4 text-center"> |
| 50 | + <h1 className="text-4xl font-bold">ATS-Optimized Resume Builder</h1> |
10 | 51 | </header> |
11 | | - <h1 className="text-center text-4xl font-bold">Click here for features details 👇🏻</h1> |
12 | | - <a href="https://github.com/codeaashu/DevDisplay/issues/601#issue-2758467731" target="_blank" rel="noreferrer"> |
13 | | - <button className="mx-auto mt-4 block inline-flex cursor-pointer items-center rounded-lg border-2 border-textSecondary bg-textSecondary px-[15px] py-1.5 text-center font-poppoins text-sm text-xl transition-all duration-500 hover:bg-transparent hover:text-textSecondary dark:text-white"> |
14 | | - <span> |
15 | | - <b>🌟 Add Resume Building Features 💌 & Get 8 Benefits 🌟</b> |
16 | | - </span> |
17 | | - </button> |
18 | | - </a> |
19 | | - <h2 className="mt-8 text-center text-3xl font-bold">Benefits of Contribution</h2> |
20 | | - <a |
21 | | - href="https://drive.google.com/file/d/17Wh9xxN_SIeEVcejoSN7K7tUhWXPvSxR/view?usp=sharing" |
22 | | - target="_blank" |
23 | | - rel="noreferrer" |
24 | | - > |
25 | | - <button className="mx-auto mt-4 block inline-flex cursor-pointer items-center rounded-lg border-2 border-textSecondary bg-textSecondary px-[15px] py-1.5 text-center font-poppoins text-lg text-sm transition-all duration-500 hover:bg-transparent hover:text-textSecondary dark:text-white"> |
26 | | - <span> |
27 | | - <b>📄 View the Benefits of Contributing to DevDisplay</b> |
28 | | - </span> |
29 | | - </button> |
30 | | - </a> |
| 52 | + |
| 53 | + <section className="mb-8"> |
| 54 | + <h2 className="text-2xl font-bold">Build Your Resume</h2> |
| 55 | + <p className="mt-2">Choose from professionally designed templates optimized for ATS.</p> |
| 56 | + <button className="mt-4 rounded bg-green-500 px-4 py-2 text-white hover:bg-green-600">Start Building</button> |
| 57 | + </section> |
| 58 | + |
| 59 | + <section className="mb-8"> |
| 60 | + <h2 className="text-2xl font-bold">Choose a Template</h2> |
| 61 | + <div className="mt-4 grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3"> |
| 62 | + {templates.map((template) => ( |
| 63 | + <div key={template.id} className="rounded border border-gray-700 bg-gray-800 p-4 text-center"> |
| 64 | + <img src={template.preview} alt={template.name} className="mx-auto mb-2 h-32 w-32 object-cover" /> |
| 65 | + <h3 className="text-lg font-bold">{template.name}</h3> |
| 66 | + <button className="mt-2 rounded bg-blue-500 px-4 py-2 text-white hover:bg-blue-600">Select</button> |
| 67 | + </div> |
| 68 | + ))} |
| 69 | + </div> |
| 70 | + </section> |
| 71 | + |
| 72 | + <section className="mb-8"> |
| 73 | + <h2 className="text-2xl font-bold">Analyze Your Resume</h2> |
| 74 | + <p className="mt-2">Upload your existing resume to check its ATS score and get suggestions for improvement.</p> |
| 75 | + <input |
| 76 | + type="file" |
| 77 | + accept=".pdf,.doc,.docx" |
| 78 | + onChange={handleFileUpload} |
| 79 | + className="mt-4 block w-full cursor-pointer rounded border border-gray-700 bg-gray-800 p-2 text-white" |
| 80 | + /> |
| 81 | + {uploadedResume && ( |
| 82 | + <div className="mt-4"> |
| 83 | + <h3 className="text-xl font-bold">Analysis Results</h3> |
| 84 | + <p>ATS Score: {atsScore}%</p> |
| 85 | + <ul className="mt-2 list-disc pl-6"> |
| 86 | + {suggestions.map((suggestion, index) => ( |
| 87 | + <li key={index}>{suggestion}</li> |
| 88 | + ))} |
| 89 | + </ul> |
| 90 | + </div> |
| 91 | + )} |
| 92 | + </section> |
| 93 | + |
| 94 | + <footer className="mt-8 text-center"> |
| 95 | + <p>Powered by DevDisplay</p> |
| 96 | + </footer> |
31 | 97 | </div> |
32 | 98 | ); |
33 | 99 | }; |
|
0 commit comments