Skip to content

Commit dc3eca7

Browse files
authored
Merge pull request #40 from code-kern-ai/renaming-dropdown
Renamed dropdown to KernDropdown and remove old Dropdown
2 parents 665d3a9 + 95a535f commit dc3eca7

33 files changed

+103
-103
lines changed

src/components/config/Config.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { selectOrganization, setOrganization } from "@/src/reduxStore/states/gen
33
import { ConfigManager } from "@/src/services/base/config";
44
import { Configuration, LocalConfig } from "@/src/types/components/config/config"
55
import { snakeCaseToCamelCase } from "@/submodules/javascript-functions/case-types-parser";
6-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
6+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
77
import { IconPlus, IconTrash } from "@tabler/icons-react";
88
import { useEffect, useState } from "react"
99
import { useSelector, useDispatch } from "react-redux";
@@ -174,7 +174,7 @@ export default function Config() {
174174
</div>
175175
{localConfig.spacyDownloads && <div className="flex flex-col gap-y-2">
176176
{localConfig.spacyDownloads.map((myConfig, index) => <div key={myConfig} className="flex flex-row flex-nowrap gap-x-2 items-center">
177-
<Dropdown2
177+
<KernDropdown
178178
options={preparedOptions}
179179
buttonName={prepareTokenizedValues.find((tokenizer: any) => tokenizer.configString == myConfig)?.name}
180180
selectedOption={(option) => changeConfigString(option, index)}

src/components/models-download/AddModelDownloadModal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { dateAsUTCDate } from "@/submodules/javascript-functions/date-parser";
99
import { extentModelsDownloaded, selectModelsDownloaded } from "@/src/reduxStore/states/pages/models-downloaded";
1010
import { ModelsDownloaded, ModelsDownloadedStatus } from "@/src/types/components/models-downloaded/models-downloaded";
1111
import { CacheEnum, selectCachedValue } from "@/src/reduxStore/states/cachedValues";
12-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
12+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
1313
import { modelProviderDownloadModel } from "@/src/services/base/misc";
1414
import { PlatformType } from "@/src/types/components/projects/projectId/settings/embeddings";
1515

@@ -79,7 +79,7 @@ export default function AddModelDownloadModal() {
7979
<Tooltip content={TOOLTIPS_DICT.MODELS_DOWNLOAD.MODEL} placement="right" color="invert">
8080
<span className="card-title mb-0 label-text flex"><span className="cursor-help underline filtersUnderline">Name</span></span>
8181
</Tooltip>
82-
<Dropdown2 options={filteredList && filteredList} useDifferentTextColor={colorDownloadedModels} differentTextColor="green" valuePropertyPath="configString"
82+
<KernDropdown options={filteredList && filteredList} useDifferentTextColor={colorDownloadedModels} differentTextColor="green" valuePropertyPath="configString"
8383
hasSearchBar={true} dropdownItemsClasses="max-h-96 overflow-y-auto" ignoreDisabledForSearch={true}
8484
selectedOption={(option: any) => {
8585
setModelName(option.configString);

src/components/projects/projectId/admin/NewPersonalTokenModal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { ModalEnum } from "@/src/types/shared/modal";
77
import { EXPIRATION_TIME, READ_WRITE_SCOPE } from "@/src/util/components/projects/projectId/project-admin-helper";
88
import { TOOLTIPS_DICT } from "@/src/util/tooltip-constants";
99
import { copyToClipboard } from "@/submodules/javascript-functions/general";
10-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
10+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
1111
import { Tooltip } from "@nextui-org/react";
1212
import { useCallback, useEffect, useState } from "react";
1313
import { useDispatch, useSelector } from "react-redux";
@@ -65,7 +65,7 @@ export default function NewPersonalToken(props: PersonalTokenModalProps) {
6565
<Tooltip content={TOOLTIPS_DICT.ADMIN_PAGE.EXPIRATION_TIME} color="invert" placement="right">
6666
<span className="cursor-help card-title mb-0 label-text flex"><span className="underline filtersUnderline">Expiration time</span></span>
6767
</Tooltip>
68-
<Dropdown2 buttonName={expirationTime.name} options={EXPIRATION_TIME} selectedOption={(option: any) => setExpirationTime(option)} dropdownClasses="w-full" />
68+
<KernDropdown buttonName={expirationTime.name} options={EXPIRATION_TIME} selectedOption={(option: any) => setExpirationTime(option)} dropdownClasses="w-full" />
6969

7070

7171
<Tooltip content={TOOLTIPS_DICT.ADMIN_PAGE.NAME_TOKEN} color="invert" placement="right">

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

+3-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { CommentDataManager } from "@/src/util/classes/comments";
2626
import { CommentType } from "@/src/types/shared/comments";
2727
import BricksIntegrator from "@/src/components/shared/bricks-integrator/BricksIntegrator";
2828
import { AttributeCodeLookup } from "@/src/util/classes/attribute-calculation";
29-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
29+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
3030
import { useWebsocket } from "@/submodules/react-components/hooks/web-socket/useWebsocket";
3131
import { postProcessLabelingTasks, postProcessLabelingTasksSchema } from "@/src/util/components/projects/projectId/settings/labeling-tasks-helper";
3232
import { getAllComments } from "@/src/services/base/comment";
@@ -326,13 +326,13 @@ export default function AttributeCalculation() {
326326
{duplicateNameExists && <div className="text-red-700 text-xs mt-2">Attribute name exists</div>}
327327
<div className="grid grid-cols-2 gap-2 items-center mt-8" style={{ gridTemplateColumns: 'max-content auto' }}>
328328
<div className="text-sm leading-5 font-medium text-gray-700">Visibility</div>
329-
<Dropdown2 buttonName={currentAttribute.visibilityName} options={ATTRIBUTES_VISIBILITY_STATES} dropdownWidth="w-52" tooltipArrayPlacement="right" tooltipsArray={tooltipsArray}
329+
<KernDropdown buttonName={currentAttribute.visibilityName} options={ATTRIBUTES_VISIBILITY_STATES} dropdownWidth="w-52" tooltipArrayPlacement="right" tooltipsArray={tooltipsArray}
330330
selectedOption={(option: any) => updateVisibility(option)} disabled={currentAttribute.state == AttributeState.USABLE} dropdownClasses="z-40" />
331331

332332
<div className="text-sm leading-5 font-medium text-gray-700">Data type</div>
333333
<div className="flex flex-row items-center">
334334
<Tooltip color="invert" placement="right" content={currentAttribute.state == AttributeState.USABLE || currentAttribute.state == AttributeState.RUNNING ? TOOLTIPS_DICT.ATTRIBUTE_CALCULATION.CANNOT_EDIT_DATATYPE : TOOLTIPS_DICT.ATTRIBUTE_CALCULATION.EDIT_DATATYPE}>
335-
<Dropdown2 buttonName={currentAttribute.dataTypeName} options={DATA_TYPES} dropdownWidth="w-52"
335+
<KernDropdown buttonName={currentAttribute.dataTypeName} options={DATA_TYPES} dropdownWidth="w-52"
336336
selectedOption={(option: any) => updateDataType(option)} disabled={currentAttribute.state == AttributeState.USABLE} dropdownClasses="z-30" />
337337
</Tooltip>
338338
{currentAttribute.dataType == DataTypeEnum.EMBEDDING_LIST && <div className="text-gray-700 text-sm ml-3">Only useable for similarity search</div>}

src/components/projects/projectId/data-browser/SearchGroups.tsx

+7-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import { Status } from "@/src/types/shared/statuses";
2626
import { postProcessCurrentWeakSupervisionRun } from "@/src/util/components/projects/projectId/heuristics/heuristics-helper";
2727
import { AttributeVisibility } from "@/src/types/components/projects/projectId/settings/data-schema";
2828
import { ChevronDownIcon } from "@heroicons/react/20/solid";
29-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
29+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
3030
import { checkActiveGroups, prefillActiveValues } from "@/src/util/components/projects/projectId/data-browser/prefill-values-helper";
3131
import { getWeakSupervisionRun } from "@/src/services/base/heuristic";
3232
import { getRecordsByStaticSlice, searchRecordsExtended } from "@/src/services/base/data-browser";
@@ -625,19 +625,19 @@ export default function SearchGroups() {
625625
<div className="flex-grow mr-2.5 flex flex-col mt-2 ">
626626
<div className="flex-grow flex flex-row flex-wrap gap-1">
627627
<div style={{ width: groupItem.operator != '' ? '49%' : '100%' }}>
628-
<Dropdown2 options={attributesSortOrder} buttonName={groupItem.name} backgroundColors={backgroundColors}
628+
<KernDropdown options={attributesSortOrder} buttonName={groupItem.name} backgroundColors={backgroundColors}
629629
selectedOption={(option: any) => selectValueDropdown(option.name, index, 'name', group.key)} fontClass="font-dmMono" buttonClasses="text-xs" />
630630
</div>
631631
<div style={{ width: '49%' }}>
632632
{groupItem.operator != '' &&
633-
<Dropdown2 options={operatorsDropdown} buttonName={groupItem.operator} tooltipsArray={tooltipsArray} tooltipArrayPlacement="right" buttonClasses="text-xs"
633+
<KernDropdown options={operatorsDropdown} buttonName={groupItem.operator} tooltipsArray={tooltipsArray} tooltipArrayPlacement="right" buttonClasses="text-xs"
634634
selectedOption={(option: any) => selectValueDropdown(option.value, index, 'operator', group.key)} fontClass="font-dmMono" />
635635
}
636636
</div>
637637
</div>
638638
{uniqueValuesDict[groupItem['name']] && groupItem['operator'] != '' && groupItem['operator'] != 'BETWEEN' && groupItem['operator'] != 'IN' && groupItem['operator'] != 'IN WC' ? (
639639
<div className="my-2">
640-
<Dropdown2 options={uniqueValuesDict[groupItem['name']]} buttonName={groupItem['searchValue'] ? groupItem['searchValue'] : 'Select value'}
640+
<KernDropdown options={uniqueValuesDict[groupItem['name']]} buttonName={groupItem['searchValue'] ? groupItem['searchValue'] : 'Select value'}
641641
selectedOption={(option: any) => selectValueDropdown(option, index, 'searchValue', group.key)} fontClass="font-dmMono" />
642642
</div>
643643
) : (
@@ -693,7 +693,7 @@ export default function SearchGroups() {
693693
{fullSearchStore[group.key] && <div className="flex-grow flex flex-col">
694694
<div>Manually labeled</div>
695695
{fullSearchStore[group.key].groupElements['manualLabels'] && fullSearchStore[group.key].groupElements['manualLabels'].length == 0 ? (<ButtonLabelsDisabled />) : (
696-
<Dropdown2 options={fullSearchStore[group.key].groupElements['manualLabels'] ?? []} buttonName={manualLabels.length == 0 ? 'None selected' : manualLabels.join(', ')} hasCheckboxesThreeStates={true} keepDrownOpen={true}
696+
<KernDropdown options={fullSearchStore[group.key].groupElements['manualLabels'] ?? []} buttonName={manualLabels.length == 0 ? 'None selected' : manualLabels.join(', ')} hasCheckboxesThreeStates={true} keepDrownOpen={true}
697697
dropdownWidth="w-80" selectedOption={(option: any) => {
698698
const labels = [...manualLabels, option.name]
699699
setManualLabels(labels);
@@ -703,7 +703,7 @@ export default function SearchGroups() {
703703

704704
<div className="mt-2">Weakly supervised</div>
705705
{fullSearchStore[group.key].groupElements['weakSupervisionLabels'] && fullSearchStore[group.key].groupElements['weakSupervisionLabels'].length == 0 ? (<ButtonLabelsDisabled />) : (
706-
<Dropdown2 options={fullSearchStore[group.key].groupElements['weakSupervisionLabels'] ?? []} buttonName={weakSupervisionLabels.length == 0 ? 'None selected' : weakSupervisionLabels.join(', ')} hasCheckboxesThreeStates={true}
706+
<KernDropdown options={fullSearchStore[group.key].groupElements['weakSupervisionLabels'] ?? []} buttonName={weakSupervisionLabels.length == 0 ? 'None selected' : weakSupervisionLabels.join(', ')} hasCheckboxesThreeStates={true}
707707
dropdownWidth="w-80" selectedOption={(option: any) => {
708708
const labels = [...weakSupervisionLabels, option.name]
709709
setWeakSupervisionLabels(labels);
@@ -731,7 +731,7 @@ export default function SearchGroups() {
731731

732732
<div className="mt-2">Model callback</div>
733733
{fullSearchStore[group.key].groupElements['modelCallbackLabels'] && fullSearchStore[group.key].groupElements['modelCallbackLabels'].length == 0 ? (<ButtonLabelsDisabled />) : (
734-
<Dropdown2 options={fullSearchStore[group.key].groupElements['modelCallbackLabels'] ?? []} buttonName={modelCallBacksLabels.length == 0 ? 'None selected' : modelCallBacksLabels.join(', ')} hasCheckboxesThreeStates={true}
734+
<KernDropdown options={fullSearchStore[group.key].groupElements['modelCallbackLabels'] ?? []} buttonName={modelCallBacksLabels.length == 0 ? 'None selected' : modelCallBacksLabels.join(', ')} hasCheckboxesThreeStates={true}
735735
dropdownWidth="w-80" selectedOption={(option: any) => {
736736
const labels = [...modelCallBacksLabels, option.name]
737737
setModelCallBacksLabels(labels);

src/components/projects/projectId/data-browser/modals/CreateOutlierSliceModal.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { selectProjectId } from "@/src/reduxStore/states/project";
55
import { createOutlierSlice } from "@/src/services/base/data-browser";
66
import { Embedding } from "@/src/types/components/projects/projectId/settings/embeddings";
77
import { ModalButton, ModalEnum } from "@/src/types/shared/modal";
8-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
8+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
99
import { useCallback, useEffect, useState } from "react";
1010
import { useSelector } from "react-redux";
1111

@@ -35,6 +35,6 @@ export default function CreateOutlierSliceModal() {
3535
{(activeSearchParams.length > 0 || similaritySearch.recordsInDisplay) && <div className="text-red-500 mb-2 flex flex-grow justify-center text-sm">
3636
Warning: your current filter selection will be removed!</div>}
3737

38-
<Dropdown2 options={onAttributeEmbeddings} buttonName={selectedEmbedding ? selectedEmbedding.name : 'Select embedding'} selectedOption={(option: any) => setSelectedEmbedding(option)} />
38+
<KernDropdown options={onAttributeEmbeddings} buttonName={selectedEmbedding ? selectedEmbedding.name : 'Select embedding'} selectedOption={(option: any) => setSelectedEmbedding(option)} />
3939
</Modal>)
4040
}

src/components/projects/projectId/data-browser/modals/SimilaritySeachModal.tsx

+5-5
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import { filterAttributesSSGroup, getPlaceholderText, prepareAttFilter, prepareF
1313
import { checkDecimalPatterns, getAttributeType, getFilterIntegrationOperatorTooltip } from "@/src/util/components/projects/projectId/data-browser/search-operators-helper";
1414
import { getColorForDataType } from "@/src/util/components/projects/projectId/settings/data-schema-helper";
1515
import { extendArrayElementsByUniqueId } from "@/submodules/javascript-functions/id-prep";
16-
import Dropdown2 from "@/submodules/react-components/components/Dropdown2";
16+
import KernDropdown from "@/submodules/react-components/components/KernDropdown";
1717
import { IconPlus, IconTrash } from "@tabler/icons-react";
1818
import { useCallback, useEffect, useState } from "react";
1919
import { useDispatch, useSelector } from "react-redux";
@@ -154,7 +154,7 @@ export default function SimilaritySearchModal() {
154154
<div className="flex flex-grow justify-center text-lg leading-6 text-gray-900 font-medium">Select embedding for similarity search </div>
155155
{(activeSearchParams.length > 0 || similaritySearch.recordsInDisplay) && <div className="text-red-500 mb-2 flex flex-grow justify-center text-sm">Warning: your current filter selection will be removed!</div>}
156156

157-
<Dropdown2 options={onAttributeEmbeddings} buttonName={selectedEmbedding ? selectedEmbedding.name : 'Select embedding'} selectedOption={(value) => setSelectedEmbedding(value)} dropdownClasses="my-2" />
157+
<KernDropdown options={onAttributeEmbeddings} buttonName={selectedEmbedding ? selectedEmbedding.name : 'Select embedding'} selectedOption={(value) => setSelectedEmbedding(value)} dropdownClasses="my-2" />
158158

159159
{filterAttributesSS && filterAttributesSS.length > 0 && <div className="flex flex-col justify-start mt-4">
160160
<div className="pr-2 bg-white text-md font-medium text-gray-900">Filter attributes</div>
@@ -175,17 +175,17 @@ export default function SimilaritySearchModal() {
175175
<div className="flex-grow mr-2.5 flex flex-col mt-2 ">
176176
<div className="flex-grow flex flex-row flex-wrap gap-1">
177177
<div style={{ width: '50%' }}>
178-
<Dropdown2 options={filterAttributesSS} buttonName={form.name} backgroundColors={colorsAttributes}
178+
<KernDropdown options={filterAttributesSS} buttonName={form.name} backgroundColors={colorsAttributes}
179179
selectedOption={(option: any) => setFilterDropdownVal(option, index, 'name')} fontClass="font-dmMono" />
180180
</div>
181181
<div style={{ width: '49%' }}>
182-
<Dropdown2 options={operatorsDict[form.name]} buttonName={form.operator} tooltipsArray={tooltipsDict[form.operator]} tooltipArrayPlacement="left"
182+
<KernDropdown options={operatorsDict[form.name]} buttonName={form.operator} tooltipsArray={tooltipsDict[form.operator]} tooltipArrayPlacement="left"
183183
selectedOption={(option: any) => setFilterDropdownVal(option, index, 'operator')} fontClass="font-dmMono" />
184184
</div>
185185
</div>
186186
{uniqueValuesDict[form['name']] && form['operator'] != '' && form['operator'] == 'EQUAL' ? (
187187
<div className="w-full mt-2">
188-
<Dropdown2 options={uniqueValuesDict[form['name']]} buttonName={form['searchValue'] ? form['searchValue'] : 'Select value'}
188+
<KernDropdown options={uniqueValuesDict[form['name']]} buttonName={form['searchValue'] ? form['searchValue'] : 'Select value'}
189189
selectedOption={(option: string) => setFilterDropdownVal(option, index, 'searchValue')} fontClass="font-dmMono" />
190190
</div>
191191
) : (<div className="my-2 flex-grow flex flex-row items-center">

0 commit comments

Comments
 (0)