Skip to content

Commit

Permalink
feat(topic source editor): not displaying ai fields if they don't exi…
Browse files Browse the repository at this point in the history
…st in object
  • Loading branch information
yonadavGit committed Jan 30, 2024
1 parent b0c1ef1 commit 9e9af3f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion static/js/AdminEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,9 @@ const AdminEditor = ({title, data, close, catMenu, pictureUploader, updateData,
<div id="newIndex">
<AdminToolHeader title={title} close={close} validate={preprocess}/>
{items.map((x) => {
if (x.includes("Hebrew") && (!Sefaria._siteSettings.TORAH_SPECIFIC)) {
if (!x) {
return null;
} else if (x.includes("Hebrew") && (!Sefaria._siteSettings.TORAH_SPECIFIC)) {
return null;
} else if (x === "Category Menu") {
return catMenu;
Expand Down
4 changes: 3 additions & 1 deletion static/js/SourceEditor.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,11 @@ const SourceEditor = ({topic, close, origData={}}) => {
requestWithCallBack({url, type: "DELETE", redirect: () => window.location.href = `/topics/${topic}`});
}
console.log(data)
let aiTitleItem = data.aiTitle ? "AI Title" : null
let aiPromptItem = data.aiPrompt ? "AI Prompt" : null
return <div>
<AdminEditor title="Source Editor" close={close} data={data} savingStatus={savingStatus}
validate={validate} items={["AI Title", "Title","Context for Prompt", "AI Prompt", "Prompt"]} deleteObj={deleteTopicSource} updateData={updateData} isNew={isNew}
validate={validate} items={[aiTitleItem, "Title", aiPromptItem, "Prompt", "Context for Prompt"]} deleteObj={deleteTopicSource} updateData={updateData} isNew={isNew}
extras={
[<div>
<label><InterfaceText>Enter Source Ref (for example: 'Yevamot.62b.9-11' or 'Yevamot 62b:9-11')</InterfaceText></label>
Expand Down

0 comments on commit 9e9af3f

Please sign in to comment.