Skip to content

Commit 3de2f74

Browse files
PR comments
1 parent 18b5695 commit 3de2f74

File tree

3 files changed

+13
-6
lines changed

3 files changed

+13
-6
lines changed

src/components/projects/ProjectCard.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { selectIsAdmin, selectUser } from "@/src/reduxStore/states/general";
22
import { closeModal, setModalStates } from "@/src/reduxStore/states/modal";
33
import { removeFromAllProjectsById } from "@/src/reduxStore/states/project";
4-
import { Project, ProjectCardProps, ProjectStatus } from "@/src/types/components/projects/projects-list";
4+
import { ProjectCardProps, ProjectStatus } from "@/src/types/components/projects/projects-list";
55
import { ModalEnum } from "@/src/types/shared/modal";
66
import { isStringTrue } from "@/submodules/javascript-functions/general";
77
import { Tooltip } from "@nextui-org/react";
@@ -41,7 +41,6 @@ export default function ProjectCard(props: ProjectCardProps) {
4141
const deleteInstant = isStringTrue(localStorage.getItem("adminInstantDelete"));
4242
if (deleteInstant) {
4343
deleteProjectPost(projectId.current, (res) => {
44-
dispatch(closeModal(ModalEnum.ADMIN_DELETE_PROJECT));
4544
dispatch(removeFromAllProjectsById(projectId.current));
4645
})
4746
}

src/components/projects/projectId/attributes/attributeId/AttributeCalculations.tsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import Statuses from "@/src/components/shared/statuses/Statuses";
22
import { selectAllLookupLists, setAllLookupLists } from "@/src/reduxStore/states/pages/lookup-lists";
33
import { selectAttributes, selectVisibleAttributeAC, setAllAttributes, setLabelingTasksAll, updateAttributeById } from "@/src/reduxStore/states/pages/settings";
44
import { selectProjectId } from "@/src/reduxStore/states/project"
5-
import { Attribute, AttributeState, LLMConfig } from "@/src/types/components/projects/projectId/settings/data-schema";
5+
import { Attribute, AttributeState, AttributeWithOnClick, LLMConfig } from "@/src/types/components/projects/projectId/settings/data-schema";
66
import { DataTypeEnum } from "@/src/types/shared/general";
77
import { LLM_PROVIDER_OPTIONS, postProcessCurrentAttribute } from "@/src/util/components/projects/projectId/settings/attribute-calculation-helper";
88
import { ATTRIBUTES_VISIBILITY_STATES, DATA_TYPES, getTooltipVisibilityState } from "@/src/util/components/projects/projectId/settings/data-schema-helper";
@@ -318,6 +318,10 @@ export default function AttributeCalculation() {
318318
[]
319319
);
320320

321+
const usableAttributesFinal = useMemo(() => usableAttributes.map((attribute) => (
322+
{ ...attribute, onClick: copyToClipboardFunc(attribute.name) }
323+
)), [usableAttributes]);
324+
321325
const disabledOptions = useMemo(() => {
322326
if (!currentAttribute || currentAttribute.dataType == DataTypeEnum.LLM_RESPONSE) return undefined;
323327
return DATA_TYPES.map((e) => e.value == DataTypeEnum.LLM_RESPONSE);
@@ -387,10 +391,10 @@ export default function AttributeCalculation() {
387391
</div>
388392
<div className="text-sm leading-5 font-medium text-gray-700 inline-block">Attributes</div>
389393
<div className="flex flex-row items-center">
390-
{usableAttributes.length == 0 && <div className="text-sm font-normal text-gray-500">No usable attributes.</div>}
391-
{usableAttributes.map((attribute: Attribute) => (
394+
{usableAttributesFinal.length == 0 && <div className="text-sm font-normal text-gray-500">No usable attributes.</div>}
395+
{usableAttributesFinal.map((attribute: AttributeWithOnClick) => (
392396
<Tooltip key={attribute.id} content={attribute.dataTypeName + ' - ' + TOOLTIPS_DICT.GENERAL.CLICK_TO_COPY} color="invert" placement="top">
393-
<span onClick={copyToClipboardFunc(attribute.name)}>
397+
<span onClick={attribute.onClick}>
394398
<div className={`cursor-pointer border items-center px-2 py-0.5 rounded text-xs font-medium text-center mr-2 ${'bg-' + attribute.color + '-100'} ${'text-' + attribute.color + '-700'} ${'border-' + attribute.color + '-400'} ${'hover:bg-' + attribute.color + '-200'}`}>
395399
{attribute.name}
396400
</div>

src/types/components/projects/projectId/settings/data-schema.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export type Attribute = {
4646
additionalConfig?: LLMConfig;
4747
}
4848

49+
export type AttributeWithOnClick = Attribute & {
50+
onClick?: () => void;
51+
}
52+
4953
export type AttributeVisibilityStates = {
5054
name: string;
5155
value: string;

0 commit comments

Comments
 (0)