fix release v2 recovery flows
This commit is contained in:
1 parent
ca856f9f54
commit
4905ea6738
44 files changed
+871
-201
No files matched your search
@@ -8,7 +8,6 @@ import {
|
||||
CloseButton,
|
||||
Combobox,
|
||||
Group,
|
||||
Input,
|
||||
Pill,
|
||||
PillsInput,
|
||||
Stack,
|
||||
@@ -38,6 +37,7 @@ export const WidgetIntegrationSelect = ({
|
||||
data,
|
||||
onChange,
|
||||
value: valueProp,
|
||||
label,
|
||||
canSelectMultiple = true,
|
||||
withAsterisk = false,
|
||||
...props
|
||||
@@ -79,6 +79,7 @@ export const WidgetIntegrationSelect = ({
|
||||
option={option}
|
||||
onRemove={() => handleValueRemove(item)}
|
||||
showRemoveButton={canSelectMultiple}
|
||||
removeLabel={t("item.edit.field.integrations.removeLabel", { name: option.name })}
|
||||
/>
|
||||
);
|
||||
});
|
||||
@@ -92,7 +93,7 @@ export const WidgetIntegrationSelect = ({
|
||||
<Avatar src={getIconUrl(item.kind)} size="sm" />
|
||||
<Stack gap={0}>
|
||||
<span>{item.name}</span>
|
||||
<Text size="xs" c="gray.6">
|
||||
<Text size="xs" c="dimmed">
|
||||
{item.url}
|
||||
</Text>
|
||||
</Stack>
|
||||
@@ -109,33 +110,42 @@ export const WidgetIntegrationSelect = ({
|
||||
inputWrapperOrder={["label", "input", "description", "error"]}
|
||||
description={
|
||||
<Text size="xs" span>
|
||||
{t.rich("widget.common.integration.description", {
|
||||
here: () => (
|
||||
<Anchor size="xs" component={Link} target="_blank" href="/manage/integrations">
|
||||
{t("common.here")}
|
||||
</Anchor>
|
||||
),
|
||||
})}
|
||||
<Anchor size="xs" component={Link} target="_blank" href="/manage/integrations">
|
||||
{t("widget.common.integration.manage")}
|
||||
</Anchor>
|
||||
</Text>
|
||||
}
|
||||
pointer
|
||||
onClick={() => combobox.toggleDropdown()}
|
||||
onClick={() => combobox.openDropdown()}
|
||||
label={label}
|
||||
withAsterisk={withAsterisk}
|
||||
{...props}
|
||||
>
|
||||
<Pill.Group>
|
||||
{values.length > 0 ? values : <Input.Placeholder>{t("common.multiSelect.placeholder")}</Input.Placeholder>}
|
||||
{values}
|
||||
|
||||
<Combobox.EventsTarget>
|
||||
<PillsInput.Field
|
||||
type="hidden"
|
||||
readOnly
|
||||
aria-label={label}
|
||||
placeholder={values.length === 0 ? t("common.multiSelect.placeholder") : undefined}
|
||||
onFocus={() => combobox.openDropdown()}
|
||||
onBlur={() => combobox.closeDropdown()}
|
||||
onKeyDown={(event) => {
|
||||
if (event.key !== "Backspace") return;
|
||||
|
||||
event.preventDefault();
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
handleValueRemove(multiSelectValues[multiSelectValues.length - 1]!);
|
||||
if (["ArrowDown", "Enter", " "].includes(event.key)) {
|
||||
event.preventDefault();
|
||||
combobox.openDropdown();
|
||||
return;
|
||||
}
|
||||
if (event.key === "Escape") {
|
||||
combobox.closeDropdown();
|
||||
return;
|
||||
}
|
||||
if (event.key === "Backspace" && multiSelectValues.length > 0) {
|
||||
event.preventDefault();
|
||||
const lastValue = multiSelectValues.at(-1);
|
||||
if (lastValue) handleValueRemove(lastValue);
|
||||
}
|
||||
}}
|
||||
/>
|
||||
</Combobox.EventsTarget>
|
||||
@@ -163,22 +173,38 @@ export interface IntegrationSelectOption {
|
||||
name: string;
|
||||
url: string;
|
||||
kind: IntegrationKind;
|
||||
permissions?: {
|
||||
hasUseAccess: boolean;
|
||||
hasInteractAccess: boolean;
|
||||
hasFullAccess: boolean;
|
||||
};
|
||||
}
|
||||
|
||||
interface IntegrationPillProps {
|
||||
option: IntegrationSelectOption;
|
||||
onRemove: () => void;
|
||||
showRemoveButton: boolean;
|
||||
removeLabel: string;
|
||||
}
|
||||
|
||||
const IntegrationPill = ({ option, onRemove, showRemoveButton }: IntegrationPillProps) => (
|
||||
const IntegrationPill = ({ option, onRemove, showRemoveButton, removeLabel }: IntegrationPillProps) => (
|
||||
<Group align="center" wrap="nowrap" gap={0} className={classes.pill} mih={24} pr={!showRemoveButton ? 10 : undefined}>
|
||||
<Avatar src={getIconUrl(option.kind)} size={14} mr={6} />
|
||||
<Text span size="xs" lh={1} fw={500}>
|
||||
{option.name}
|
||||
</Text>
|
||||
{showRemoveButton && (
|
||||
<CloseButton onMouseDown={onRemove} variant="transparent" color="gray" size={22} iconSize={14} tabIndex={-1} />
|
||||
<CloseButton
|
||||
onClick={(event) => {
|
||||
event.stopPropagation();
|
||||
onRemove();
|
||||
}}
|
||||
aria-label={removeLabel}
|
||||
variant="transparent"
|
||||
color="gray"
|
||||
size={24}
|
||||
iconSize={14}
|
||||
/>
|
||||
)}
|
||||
</Group>
|
||||
);
|
||||
Reference in new issue
Block a user