Rework the integration UI so Add and Manage are separate surfaces, only active integrations appear in Manage, and integrations with settings (e.g. Bitcoin) can be edited via the same form used to add them. Replace the ModalDialog/initialComponent flow with a modal service and a single ModalHost that lazily mounts each dialog body, so forms and custom elements start fresh per open. Move integration components to settings/integrations, add an integrations service that unifies registry capabilities with live instances, and fix the select value refresh and bitcoin config reset.
91 lines
3.6 KiB
Plaintext
91 lines
3.6 KiB
Plaintext
import Component from '@glimmer/component';
|
|
import { action } from '@ember/object';
|
|
import { on } from '@ember/modifier';
|
|
import setSelectValue from '../../../modifiers/set-select-value';
|
|
|
|
export default class SettingsIntegrationsSelect extends Component {
|
|
get selectedLabel() {
|
|
const selected = this.args.options?.find(
|
|
(option) => String(option.value) === String(this.args.value)
|
|
);
|
|
return selected?.label ?? '';
|
|
}
|
|
|
|
@action
|
|
handleChange(event) {
|
|
this.args.onChange?.(event.target.value);
|
|
}
|
|
|
|
<template>
|
|
<div>
|
|
<label
|
|
for={{@id}}
|
|
class="block text-sm/6 font-medium text-gray-900"
|
|
>{{@label}}</label>
|
|
<el-select
|
|
id={{@id}}
|
|
name={{@name}}
|
|
class="mt-2 block"
|
|
{{setSelectValue @value}}
|
|
{{on "change" this.handleChange}}
|
|
>
|
|
<button
|
|
type="button"
|
|
class="grid w-full cursor-default grid-cols-1 rounded-md bg-white py-1.5 pr-2 pl-3 text-left text-gray-900 outline-1 -outline-offset-1 outline-gray-300 focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-indigo-600 sm:text-sm/6"
|
|
>
|
|
<el-selectedcontent
|
|
class="col-start-1 row-start-1 truncate pr-6"
|
|
>{{this.selectedLabel}}</el-selectedcontent>
|
|
<svg
|
|
viewBox="0 0 16 16"
|
|
fill="currentColor"
|
|
data-slot="icon"
|
|
aria-hidden="true"
|
|
class="col-start-1 row-start-1 size-5 self-center justify-self-end text-gray-500 sm:size-4"
|
|
>
|
|
<path
|
|
d="M5.22 10.22a.75.75 0 0 1 1.06 0L8 11.94l1.72-1.72a.75.75 0 1 1 1.06 1.06l-2.25 2.25a.75.75 0 0 1-1.06 0l-2.25-2.25a.75.75 0 0 1 0-1.06ZM10.78 5.78a.75.75 0 0 1-1.06 0L8 4.06 6.28 5.78a.75.75 0 0 1-1.06-1.06l2.25-2.25a.75.75 0 0 1 1.06 0l2.25 2.25a.75.75 0 0 1 0 1.06Z"
|
|
clip-rule="evenodd"
|
|
fill-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
|
|
<el-options
|
|
anchor="bottom start"
|
|
popover
|
|
class="max-h-60 w-(--button-width) overflow-auto rounded-md bg-white py-1 text-base shadow-lg outline-1 outline-black/5 [--anchor-gap:--spacing(1)] data-leave:transition data-leave:transition-discrete data-leave:duration-100 data-leave:ease-in data-closed:data-leave:opacity-0 sm:text-sm"
|
|
>
|
|
{{#each @options as |option|}}
|
|
<el-option
|
|
value={{option.value}}
|
|
class="group/option relative block cursor-default py-2 pr-9 pl-3 text-gray-900 select-none focus:bg-indigo-600 focus:text-white focus:outline-hidden"
|
|
>
|
|
<span
|
|
class="block truncate font-normal group-aria-selected/option:font-semibold"
|
|
>{{option.label}}</span>
|
|
<span
|
|
class="absolute inset-y-0 right-0 flex items-center pr-4 text-indigo-600 group-not-aria-selected/option:hidden group-focus/option:text-white in-[el-selectedcontent]:hidden"
|
|
>
|
|
<svg
|
|
viewBox="0 0 20 20"
|
|
fill="currentColor"
|
|
data-slot="icon"
|
|
aria-hidden="true"
|
|
class="size-5"
|
|
>
|
|
<path
|
|
d="M16.704 4.153a.75.75 0 0 1 .143 1.052l-8 10.5a.75.75 0 0 1-1.127.075l-4.5-4.5a.75.75 0 0 1 1.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 0 1 1.05-.143Z"
|
|
clip-rule="evenodd"
|
|
fill-rule="evenodd"
|
|
/>
|
|
</svg>
|
|
</span>
|
|
</el-option>
|
|
{{/each}}
|
|
</el-options>
|
|
</el-select>
|
|
</div>
|
|
</template>
|
|
}
|