Remove Clock, Connected Apps and Notifications from the settings menu and move Site Links under Integrations. Extract a shared integration grid (two-column cards with settings/reconnect/remove icon buttons) used by both Calendar and Site Links, and add a Site Links section that lists the dashboard quick-link integrations alphabetically. Manage Integrations now excludes calendars and site links, which are managed from their settings sections.
141 lines
5.1 KiB
Plaintext
141 lines
5.1 KiB
Plaintext
import { fn } from '@ember/helper';
|
|
import { on } from '@ember/modifier';
|
|
import Avatar from '../../integrations/avatar.gjs';
|
|
|
|
// Feather icons (https://feathericons.com), one path per element.
|
|
const SETTINGS_ICON = [
|
|
'M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z',
|
|
'M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 0 1 0 2.83 2 2 0 0 1-2.83 0l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-2 2 2 2 0 0 1-2-2v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 0 1-2.83 0 2 2 0 0 1 0-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1-2-2 2 2 0 0 1 2-2h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 0 1 0-2.83 2 2 0 0 1 2.83 0l.06.06a1.65 1.65 0 0 0 1.82.33H9a1.65 1.65 0 0 0 1-1.51V3a2 2 0 0 1 2-2 2 2 0 0 1 2 2v.09a1.65 1.65 0 0 0 1 1.51 1.65 1.65 0 0 0 1.82-.33l.06-.06a2 2 0 0 1 2.83 0 2 2 0 0 1 0 2.83l-.06.06a1.65 1.65 0 0 0-.33 1.82V9a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 2 2 2 2 0 0 1-2 2h-.09a1.65 1.65 0 0 0-1.51 1z',
|
|
];
|
|
|
|
const RECONNECT_ICON = [
|
|
'M23 4v6h-6',
|
|
'M1 20v-6h6',
|
|
'M3.51 9a9 9 0 0 1 14.85-3.36L23 10M1 14l4.64 4.36A9 9 0 0 0 20.49 15',
|
|
];
|
|
|
|
const REMOVE_ICON = [
|
|
'M12 2a10 10 0 1 0 0 20a10 10 0 1 0 0-20z',
|
|
'M15 9l-6 6',
|
|
'M9 9l6 6',
|
|
];
|
|
|
|
const ACTION_BUTTON_CLASS =
|
|
'rounded-md p-1.5 text-gray-400 transition-colors hover:bg-gray-100 hover:text-gray-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600';
|
|
|
|
// A two-column grid of integration cards with icon actions. Shared by the
|
|
// Calendar and Site Links settings sections so they stay consistent.
|
|
<template>
|
|
{{#if @rows.length}}
|
|
<ul class="grid grid-cols-1 gap-3 sm:grid-cols-2">
|
|
{{#each @rows as |row|}}
|
|
<li
|
|
data-instance={{row.id}}
|
|
data-integration={{row.type}}
|
|
class="flex items-center gap-3 rounded-lg border border-gray-200 p-3"
|
|
>
|
|
<Avatar @integration={{row}} />
|
|
|
|
<div class="min-w-0 flex-auto">
|
|
<p class="truncate text-sm font-medium text-gray-700">
|
|
{{row.label}}
|
|
</p>
|
|
<p class="truncate text-sm text-gray-500">{{row.byline}}</p>
|
|
{{#if row.error}}
|
|
<p class="truncate text-sm text-red-600">{{row.error}}</p>
|
|
{{/if}}
|
|
</div>
|
|
|
|
<div class="flex shrink-0 items-center">
|
|
{{#if row.hasSettings}}
|
|
<button
|
|
type="button"
|
|
data-test-settings
|
|
aria-label="Settings"
|
|
title="Settings"
|
|
{{on "click" (fn @onEdit row)}}
|
|
class={{ACTION_BUTTON_CLASS}}
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.5"
|
|
aria-hidden="true"
|
|
class="size-5"
|
|
>
|
|
{{#each SETTINGS_ICON as |d|}}
|
|
<path
|
|
d={{d}}
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
/>
|
|
{{/each}}
|
|
</svg>
|
|
</button>
|
|
{{/if}}
|
|
|
|
{{#if row.canReconnect}}
|
|
<button
|
|
type="button"
|
|
data-test-reconnect
|
|
aria-label="Reconnect"
|
|
title="Reconnect"
|
|
{{on "click" (fn @onReconnect row)}}
|
|
class={{ACTION_BUTTON_CLASS}}
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.5"
|
|
aria-hidden="true"
|
|
class="size-5"
|
|
>
|
|
{{#each RECONNECT_ICON as |d|}}
|
|
<path
|
|
d={{d}}
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
/>
|
|
{{/each}}
|
|
</svg>
|
|
</button>
|
|
{{/if}}
|
|
|
|
<button
|
|
type="button"
|
|
data-test-remove
|
|
aria-label="Remove"
|
|
title="Remove"
|
|
{{on "click" (fn @onRemove row)}}
|
|
class="rounded-md p-1.5 text-gray-400 transition-colors hover:bg-red-50 hover:text-red-600 focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600"
|
|
>
|
|
<svg
|
|
viewBox="0 0 24 24"
|
|
fill="none"
|
|
stroke="currentColor"
|
|
stroke-width="1.5"
|
|
aria-hidden="true"
|
|
class="size-5"
|
|
>
|
|
{{#each REMOVE_ICON as |d|}}
|
|
<path
|
|
d={{d}}
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
/>
|
|
{{/each}}
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
</li>
|
|
{{/each}}
|
|
</ul>
|
|
{{else}}
|
|
<p class="rounded-xl bg-gray-50 p-6 text-center text-sm text-gray-500">
|
|
{{@emptyLabel}}
|
|
</p>
|
|
{{/if}}
|
|
</template>
|