feat(jobs): complete workspace draft parity
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { useEffect, useState } from "react";
|
||||
|
||||
import { api } from "../../api";
|
||||
import { extractApplicationAnswerDraft } from "../../applicationDrafts";
|
||||
import { AttachmentItem, JobApplication } from "../../types";
|
||||
|
||||
type PackageWorkspaceState = {
|
||||
@@ -9,23 +10,6 @@ type PackageWorkspaceState = {
|
||||
recruiterMessage: string;
|
||||
};
|
||||
|
||||
const APPLICATION_ANSWER_START = "<<<APPLICATION_ANSWER_DRAFT>>>";
|
||||
const APPLICATION_ANSWER_END = "<<<END_APPLICATION_ANSWER_DRAFT>>>";
|
||||
|
||||
function extractApplicationAnswerDraft(notes?: string | null) {
|
||||
const value = (notes ?? "").trim();
|
||||
if (!value) return "";
|
||||
|
||||
const startIndex = value.indexOf(APPLICATION_ANSWER_START);
|
||||
const endIndex = value.indexOf(APPLICATION_ANSWER_END);
|
||||
if (startIndex >= 0 && endIndex > startIndex) {
|
||||
return value.slice(startIndex + APPLICATION_ANSWER_START.length, endIndex).trim();
|
||||
}
|
||||
|
||||
const legacyMatch = value.match(/Application answer draft:\s*\n([\s\S]*)$/i);
|
||||
return legacyMatch?.[1]?.trim() ?? "";
|
||||
}
|
||||
|
||||
export function useJobWorkspaceBaseData({
|
||||
open,
|
||||
jobId,
|
||||
@@ -124,5 +108,4 @@ export function useJobWorkspaceBaseData({
|
||||
};
|
||||
}
|
||||
|
||||
export { extractApplicationAnswerDraft };
|
||||
export type { PackageWorkspaceState };
|
||||
|
||||
Reference in New Issue
Block a user