@igamingcareer/igaming-components 1.0.67 → 1.0.69

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. package/Readme.md +65 -0
  2. package/dist/index.js +1573 -1573
  3. package/dist/index.mjs +8329 -8207
  4. package/package.json +6 -6
package/Readme.md CHANGED
@@ -69,6 +69,71 @@ export function Example() {
69
69
  }
70
70
  ```
71
71
 
72
+ ## CV upload from the dashboard
73
+
74
+ The dashboard emits CV upload events so the host application can upload, store,
75
+ and extract text. The component library does **not** parse PDFs directly — pass
76
+ the extracted preview text back into the dashboard to display it.
77
+
78
+ ```tsx
79
+ import { useCallback, useState } from "react";
80
+ import { Dashboard } from "@igamingcareer/igaming-components";
81
+
82
+ export function DashboardWithCvUpload() {
83
+ const [cvPreviewText, setCvPreviewText] = useState("");
84
+ const [cvPreviewStatus, setCvPreviewStatus] = useState<
85
+ "idle" | "parsing" | "error"
86
+ >("idle");
87
+ const [cvPreviewErrorMessage, setCvPreviewErrorMessage] = useState<
88
+ string | undefined
89
+ >(undefined);
90
+
91
+ const handleUploadCV = useCallback(async (file: File | null) => {
92
+ if (!file) {
93
+ setCvPreviewText("");
94
+ setCvPreviewStatus("idle");
95
+ setCvPreviewErrorMessage(undefined);
96
+ return;
97
+ }
98
+
99
+ try {
100
+ setCvPreviewStatus("parsing");
101
+ setCvPreviewErrorMessage(undefined);
102
+
103
+ // Upload the file to your backend and parse the PDF there.
104
+ // const response = await uploadResume(file);
105
+ // setCvPreviewText(response.text);
106
+ // Example placeholder:
107
+ setCvPreviewText("Preview text returned by your backend.");
108
+ setCvPreviewStatus("idle");
109
+ } catch (error) {
110
+ setCvPreviewStatus("error");
111
+ setCvPreviewErrorMessage(
112
+ "We couldn't extract text from this CV. The file is still saved."
113
+ );
114
+ }
115
+ }, []);
116
+
117
+ return (
118
+ <Dashboard
119
+ user={{ name: "Jane Doe", email: "jane@example.com" }}
120
+ profileData={/* your profile data */}
121
+ alerts={[]}
122
+ snapshot={[]}
123
+ feedItems={[]}
124
+ onUpdateProfile={async () => {}}
125
+ onUploadCV={handleUploadCV}
126
+ cvPreviewText={cvPreviewText}
127
+ cvPreviewStatus={cvPreviewStatus}
128
+ cvPreviewErrorMessage={cvPreviewErrorMessage}
129
+ />
130
+ );
131
+ }
132
+ ```
133
+
134
+ Use the `file` argument to upload the PDF to your backend. When the upload is
135
+ deleted from the dialog, the handler receives `null`.
136
+
72
137
  ## Tag badge and tag picker
73
138
 
74
139
  Use the `TagBadge` component to display tags (for job cards, filters, etc.) and the `TagPicker` component to select or create tags.