([]);
@@ -28,12 +29,24 @@ export function TagEditor(props: {
.filter((tag) => tag.kind === "Contact")
.sort(sortByLastUsed)
);
+ if (props.autoFillTag && availableTags()) {
+ const tagToAutoSelect = availableTags().find(
+ (tag) => tag.name === props.autoFillTag
+ );
+ if (tagToAutoSelect) {
+ props.setSelectedValues([
+ ...props.selectedValues,
+ tagToAutoSelect
+ ]);
+ }
+ }
}
});
const selectProps = createMemo(() => {
return createOptions(availableTags() || [], {
key: "name",
+ disable: (value) => props.selectedValues.includes(value),
filterable: true, // Default
createable: createLabelValue
});
@@ -42,8 +55,6 @@ export function TagEditor(props: {
const onChange = (selected: MutinyTagItem[]) => {
props.setSelectedValues(selected);
- console.log(selected);
-
const lastValue = selected[selected.length - 1];
if (
lastValue &&
@@ -54,7 +65,6 @@ export function TagEditor(props: {
}
};
- // FIXME: eslint is mad about reactivity
const onTagTap = (tag: MutinyTagItem) => {
props.setSelectedValues([...props.selectedValues!, tag]);
};
@@ -70,10 +80,16 @@ export function TagEditor(props: {
/>
0}>
-
+
{(tag) => (
- // eslint-disable-next-line solid/reactivity
- onTagTap(tag)}>
+ onTagTap(tag)}
+ >
{tag.name}
)}
diff --git a/src/components/layout/Misc.tsx b/src/components/layout/Misc.tsx
index 366ae52..2b9b670 100644
--- a/src/components/layout/Misc.tsx
+++ b/src/components/layout/Misc.tsx
@@ -258,6 +258,7 @@ export const TinyText: ParentComponent = (props) => {
export const TinyButton: ParentComponent<{
onClick: () => void;
tag?: MutinyTagItem;
+ hidden?: boolean;
}> = (props) => {
// TODO: don't need to run this if it's not a contact
const [gradient] = createResource(async () => {
@@ -272,6 +273,7 @@ export const TinyButton: ParentComponent<{
return (