WIP Add modal for adding integrations to dashboard

This commit is contained in:
raucao committed 2025-11-01 12:08:25 +01:00
1 parent ccf99fa310
commit df6a4f075e
5 files changed
+124

No files matched your search

@@ -0,0 +1,14 @@
import Component from '@glimmer/component';
export default class SettingsAddIntegrationDiscourse extends Component {
<template>
<div class="p-6">
<h3 id="dialog-title" class="text-base font-semibold leading-6 text-gray-900">Add Discourse Integration</h3>
<div class="mt-2">
<p class="text-sm text-gray-500">
Configure your Discourse forum integration here.
</p>
</div>
</div>
</template>
}
@@ -0,0 +1,44 @@
import Component from '@glimmer/component';
import { on } from '@ember/modifier';
import { fn } from '@ember/helper';
import Discourse from './discourse.gjs';
export default class SettingsAddIntegrationList extends Component {
<template>
<div class="block max-h-96 p-4 transform-gpu scroll-py-3 overflow-y-auto">
<button
type="button"
{{on "click" (fn @switchComponent Discourse)}}
class="group flex w-full rounded-xl p-3 cursor-pointer select-none focus:outline-hidden hover:bg-gray-100 aria-selected:bg-gray-100">
<div class="flex size-10 flex-none items-center justify-center rounded-lg bg-indigo-500">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-slot="icon" class="size-6 text-white">
<path d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</div>
<div class="ml-4 flex-auto text-left">
<p id="item-1-label" class="text-sm font-medium text-gray-700 group-aria-selected:text-gray-900">
Discourse
</p>
<p class="text-sm text-gray-500 group-aria-selected:text-gray-700">
Notifications from your discussion forums
</p>
</div>
</button>
<button type="button" disabled class="group flex w-full cursor-default rounded-xl p-3 select-none focus:outline-hidden">
<div class="flex size-10 flex-none items-center justify-center rounded-lg bg-gray-300">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" data-slot="icon" class="size-6 text-white">
<path d="m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10" stroke-linecap="round" stroke-linejoin="round" />
</svg>
</div>
<div class="ml-4 flex-auto text-left">
<p id="item-1-label" class="text-sm font-medium text-gray-400">
Gitea
</p>
<p class="text-sm text-gray-400">
Notifications from your Git hosting servers
</p>
</div>
</button>
</div>
</template>
}
+10
View File
@@ -4,11 +4,21 @@ import { on } from '@ember/modifier';
import DefaultClock from '../components/default-clock.gjs';
import ModalDialog from '../components/modal-dialog.gjs';
import ModalStepOne from '../components/modal-step-one.gjs';
import { default as SettingsAddIntegrationList } from '../components/settings/add-integration/list.gjs';
export default class IndexRoute extends Component {
<template>
{{pageTitle "New Tab"}}
<div class="col-start-3 row-start-1 flex items-center justify-center gap-4">
<button command="show-modal" commandfor="modal-settings-add-integration"
class="rounded-md px-2.5 py-1.5 text-white border border-white hover:bg-gray-950/10" type="button">
Add Integration
</button>
<ModalDialog @initialComponent={{SettingsAddIntegrationList}} @id="modal-settings-add-integration" />
</div>
<div class="col-start-2 row-start-2 flex items-center justify-center">
<DefaultClock />
</div>
@@ -0,0 +1,28 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dashtab/tests/helpers';
import { render } from '@ember/test-helpers';
import Discourse from 'dashtab/components/settings/add-integration/discourse';
module('Integration | Component | settings/add-integration/discourse', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Updating values is achieved using autotracking, just like in app code. For example:
// class State { @tracked myProperty = 0; }; const state = new State();
// and update using state.myProperty = 1; await rerender();
// Handle any actions with function myAction(val) { ... };
await render(<template><Discourse /></template>);
assert.dom().hasText('');
// Template block usage:
await render(<template>
<Discourse>
template block text
</Discourse>
</template>);
assert.dom().hasText('template block text');
});
});
@@ -0,0 +1,28 @@
import { module, test } from 'qunit';
import { setupRenderingTest } from 'dashtab/tests/helpers';
import { render } from '@ember/test-helpers';
import List from 'dashtab/components/settings/add-integration/list';
module('Integration | Component | settings/add-integration/list', function (hooks) {
setupRenderingTest(hooks);
test('it renders', async function (assert) {
// Updating values is achieved using autotracking, just like in app code. For example:
// class State { @tracked myProperty = 0; }; const state = new State();
// and update using state.myProperty = 1; await rerender();
// Handle any actions with function myAction(val) { ... };
await render(<template><List /></template>);
assert.dom().hasText('');
// Template block usage:
await render(<template>
<List>
template block text
</List>
</template>);
assert.dom().hasText('template block text');
});
});