Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update/coding language #925

Merged
merged 2 commits into from
Nov 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions frontend/app/src/components/form/bounty/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -673,8 +673,8 @@ function Form(props: FormProps) {
BountyDetailsCreationData.step_3,
BountyDetailsCreationData.step_4,
BountyDetailsCreationData.step_5
].map((section: any) => (
<div style={{ width: '100%' }}>
].map((section: any, index: number) => (
<div style={{ width: '100%' }} key={index}>
<h4 style={{ marginTop: '20px' }}>
<b>{section.heading}</b>
</h4>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ interface styledProps {
}

const ExtraText = styled.div`
padding: 2px 10px 25px 10px;
max - width: calc(100 % - 20px);
word -break: break-all;
font - size: 14px;
padding: 2px 10px 25px 10px;
max-width: calc(100 % - 20px);
word-break: break-all;
font-size: 14px;
`;

const E = styled.div<styledProps>`
position: absolute;
right: 10px;
top: 0px;
display: flex;
height: 100 %;
justify - content: center;
align - items: center;
color: ${(p: any) => p?.color && p.color.blue3};
pointer - events: none;
user - select: none;
position: absolute;
right: 10px;
top: 0px;
display: flex;
height: 100%;
justify-content: center;
align-items: center;
color: ${(p: any) => p?.color && p.color.blue3};
pointer-events: none;
user-select: none;
`;
const R = styled.div`
position: relative;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,11 @@ interface labelProps {
value?: any;
}

interface Data {
value: string;
label: string;
}

const EuiPopOverCheckbox = styled.div<styledProps>`
height: 180px;
padding: 10px 0px 0px 20px;
Expand Down Expand Up @@ -88,7 +93,7 @@ const Label = styled.div<labelProps>`
`;
const codingLanguages = GetValue(coding_languages);

export default function CreatableMultiSelectInputNew({ error, label, handleChange }: Props) {
export default function CreatableMultiSelectInputNew({ error, label, handleChange, value }: Props) {
let labeltext = label;
if (error) labeltext = `${labeltext} (INCORRECT FORMAT)`;
const color = colors['light'];
Expand All @@ -98,7 +103,7 @@ export default function CreatableMultiSelectInputNew({ error, label, handleChang
const closePopover = () => setIsPopoverOpen(false);
const [checkboxIdToSelectedMap, setCheckboxIdToSelectedMap] = useState({});
const [labels, setLabels] = useState<any>([]);
const [data, setData] = useState<any>([]);
const [data, setData] = useState<Data[]>((Array.isArray(value) && [...value]) || []);

const onChange = (optionId: any) => {
let trueCount = 0;
Expand All @@ -114,15 +119,36 @@ export default function CreatableMultiSelectInputNew({ error, label, handleChang
[optionId]: !checkboxIdToSelectedMap[optionId]
}
};
let newData: Data[] = [];
if (newCheckboxIdToSelectedMap[optionId]) {
newData = [...data, { value: optionId, label: optionId }];
} else {
const oldData: Data[] = [...data];
const index = data.findIndex((currentData: Data) => currentData.value === optionId);
oldData.splice(index, 1);
newData = [...oldData];
}

setCheckboxIdToSelectedMap(newCheckboxIdToSelectedMap);
handleChange(newData);
setData(newData);
}
};

useEffect(() => {
setLabels(LanguageObject.filter((x: any) => checkboxIdToSelectedMap[x.label]));
}, [checkboxIdToSelectedMap]);

useEffect(() => {
if (Array.isArray(value)) {
const newValue = {};
for (let i = 0; i < value.length; i++) {
newValue[value[i].value] = true;
}
setCheckboxIdToSelectedMap(newValue);
setData([...value]);
}
}, []);
return (
<div
style={{
Expand Down Expand Up @@ -184,8 +210,6 @@ export default function CreatableMultiSelectInputNew({ error, label, handleChang
idToSelectedMap={checkboxIdToSelectedMap}
onChange={(id: any) => {
onChange(id);
setData([...data, { value: id, label: id }]);
handleChange(data);
}}
/>
</EuiPopOverCheckbox>
Expand Down
28 changes: 14 additions & 14 deletions frontend/app/src/components/form/inputs/SearchableSelectInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,23 @@ interface styledProps {
}

const ExtraText = styled.div`
padding: 2px 10px 25px 10px;
max - width: calc(100 % - 20px);
word -break: break-all;
font - size: 14px;
padding: 2px 10px 25px 10px;
max-width: calc(100 % - 20px);
word-break: break-all;
font-size: 14px;
`;

const E = styled.div<styledProps>`
position: absolute;
right: 10px;
top: 0px;
display: flex;
height: 100 %;
justify - content: center;
align - items: center;
color: ${(p: any) => p?.color && p?.color.blue3};
pointer - events: none;
user - select: none;
position: absolute;
right: 10px;
top: 0px;
display: flex;
height: 100%;
justify-content: center;
align-items: center;
color: ${(p: any) => p?.color && p?.color.blue3};
pointer-events: none;
user-select: none;
`;
const R = styled.div`
position: relative;
Expand Down
26 changes: 13 additions & 13 deletions frontend/app/src/people/utils/Badges.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,19 +100,19 @@ const Status = styled.div`
justify-content: center;
`;
const StatusText = styled.div`
display:flex;
justify-content:center;
align-items:center;
// height:26px;
color:#B0B7BC;
font-size: 10px;
padding 0 10px;
cursor: pointer;
&:hover{
color:#618AFF99;
}
`;
display: flex;
justify-content: center;
align-items: center;
// height:26px;
color: #b0b7bc;
font-size: 10px;
padding: 0 10px;
cursor: pointer;

&:hover {
color: #618aff99;
}
`;
const Counter = styled.div``;

interface ImageProps {
Expand Down
Loading