Upload frontend/src/views/officer/DriveCreationReview.tsx with huggingface_hub
Browse files
frontend/src/views/officer/DriveCreationReview.tsx
CHANGED
|
@@ -1,4 +1,4 @@
|
|
| 1 |
-
import React, { useState } from "react";
|
| 2 |
import { api } from "../../api/client";
|
| 3 |
import { ExtractionParseResult } from "../../types";
|
| 4 |
import { Badge } from "../../components/common/Badge";
|
|
@@ -38,6 +38,23 @@ export const DriveCreationReview: React.FC<DriveCreationReviewProps> = ({ onSucc
|
|
| 38 |
const [successMsg, setSuccessMsg] = useState<string | null>(null);
|
| 39 |
const [editingField, setEditingField] = useState<string | null>(null);
|
| 40 |
const [editValue, setEditValue] = useState<string>("");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 41 |
|
| 42 |
const handleExtract = async () => {
|
| 43 |
try {
|
|
@@ -127,6 +144,31 @@ export const DriveCreationReview: React.FC<DriveCreationReviewProps> = ({ onSucc
|
|
| 127 |
{error && <AlertBanner type="danger" message={error} onClose={() => setError(null)} />}
|
| 128 |
{successMsg && <AlertBanner type="success" message={successMsg} onClose={() => setSuccessMsg(null)} />}
|
| 129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 130 |
{/* Input Section */}
|
| 131 |
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-xs space-y-4">
|
| 132 |
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|
|
|
|
| 1 |
+
import React, { useState, useEffect } from "react";
|
| 2 |
import { api } from "../../api/client";
|
| 3 |
import { ExtractionParseResult } from "../../types";
|
| 4 |
import { Badge } from "../../components/common/Badge";
|
|
|
|
| 38 |
const [successMsg, setSuccessMsg] = useState<string | null>(null);
|
| 39 |
const [editingField, setEditingField] = useState<string | null>(null);
|
| 40 |
const [editValue, setEditValue] = useState<string>("");
|
| 41 |
+
const [samples, setSamples] = useState<Array<{ filename: string; label: string; format: string; company_name: string; text: string }>>([]);
|
| 42 |
+
|
| 43 |
+
useEffect(() => {
|
| 44 |
+
api.get<any[]>("/api/extract/samples").then((res) => {
|
| 45 |
+
if (res && res.length) setSamples(res);
|
| 46 |
+
}).catch(() => {});
|
| 47 |
+
}, []);
|
| 48 |
+
|
| 49 |
+
const handleSelectSample = (sampleFilename: string) => {
|
| 50 |
+
const s = samples.find((x) => x.filename === sampleFilename);
|
| 51 |
+
if (!s) return;
|
| 52 |
+
setCompanyName(s.company_name);
|
| 53 |
+
setInputText(s.text);
|
| 54 |
+
setFile(null);
|
| 55 |
+
setParseResult(null);
|
| 56 |
+
setSuccessMsg("Loaded real-format announcement: " + s.label);
|
| 57 |
+
};
|
| 58 |
|
| 59 |
const handleExtract = async () => {
|
| 60 |
try {
|
|
|
|
| 144 |
{error && <AlertBanner type="danger" message={error} onClose={() => setError(null)} />}
|
| 145 |
{successMsg && <AlertBanner type="success" message={successMsg} onClose={() => setSuccessMsg(null)} />}
|
| 146 |
|
| 147 |
+
{/* 25 Real-Format Drive Announcements Sample Selector */}
|
| 148 |
+
{samples.length > 0 && (
|
| 149 |
+
<div className="bg-gradient-to-r from-[#0d1527] to-[#121e38] border border-[#1b2b4d] rounded-2xl p-4 flex flex-col sm:flex-row sm:items-center justify-between gap-3 text-slate-100 shadow-md">
|
| 150 |
+
<div className="flex items-center gap-2.5">
|
| 151 |
+
<Sparkles className="w-4 h-4 text-emerald-400 shrink-0" />
|
| 152 |
+
<div>
|
| 153 |
+
<div className="text-xs font-bold text-white">25 Real-Format Drive Announcements (Emails, PDFs, DOCXs)</div>
|
| 154 |
+
<div className="text-[11px] text-slate-400">Anonymised company emails, PDFs & specifications received by placement cells.</div>
|
| 155 |
+
</div>
|
| 156 |
+
</div>
|
| 157 |
+
<select
|
| 158 |
+
onChange={(e) => e.target.value && handleSelectSample(e.target.value)}
|
| 159 |
+
defaultValue=""
|
| 160 |
+
className="px-3 py-1.5 bg-[#080e1c] border border-[#1e3258] rounded-xl text-xs font-semibold text-emerald-300 focus:outline-none cursor-pointer max-w-xs"
|
| 161 |
+
>
|
| 162 |
+
<option value="" disabled>Choose Announcement (1 of 25)...</option>
|
| 163 |
+
{samples.map((s) => (
|
| 164 |
+
<option key={s.filename} value={s.filename}>
|
| 165 |
+
{s.label}
|
| 166 |
+
</option>
|
| 167 |
+
))}
|
| 168 |
+
</select>
|
| 169 |
+
</div>
|
| 170 |
+
)}
|
| 171 |
+
|
| 172 |
{/* Input Section */}
|
| 173 |
<div className="bg-white p-6 rounded-2xl border border-slate-200 shadow-xs space-y-4">
|
| 174 |
<div className="grid grid-cols-1 md:grid-cols-3 gap-4">
|