Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 1 | import '@material/web/fab/fab.js'; |
Renovate bot | aa5fb8e | 2024-02-25 18:10:09 +0000 | [diff] [blame] | 2 | import '@material/web/icon/icon.js'; |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 3 | import './components/List.js'; |
| 4 | import './components/AddDialog.js'; |
Adrià Vilanova Martínez | 8803b6c | 2022-10-17 00:36:38 +0200 | [diff] [blame] | 5 | import './components/WorkflowDialog.js'; |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 6 | |
| 7 | import {css, html, LitElement} from 'lit'; |
| 8 | import {createRef, ref} from 'lit/directives/ref.js'; |
| 9 | |
| 10 | import {SHARED_MD3_STYLES} from '../../common/styles/md3.js'; |
Adrià Vilanova Martínez | 7f1e8ea | 2022-10-14 15:50:11 +0200 | [diff] [blame] | 11 | import {default as WorkflowsStorage, kWorkflowsDataKey} from '../workflowsStorage.js'; |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 12 | |
| 13 | export default class WFApp extends LitElement { |
| 14 | static styles = [ |
| 15 | SHARED_MD3_STYLES, |
| 16 | css` |
| 17 | :host { |
| 18 | font-family: 'Roboto', -apple-system, BlinkMacSystemFont, 'Segoe UI', |
| 19 | Helvetica, Arial, sans-serif, 'Apple Color Emoji', |
| 20 | 'Segoe UI Emoji', 'Segoe UI Symbol'!important; |
| 21 | |
| 22 | display: block; |
| 23 | max-width: 1024px; |
| 24 | margin: auto; |
| 25 | position: relative; |
| 26 | } |
| 27 | |
| 28 | md-fab { |
| 29 | position: fixed; |
| 30 | bottom: 2em; |
| 31 | right: 2em; |
| 32 | } |
| 33 | `, |
| 34 | ]; |
| 35 | |
| 36 | addFabRef = createRef(); |
Adrià Vilanova Martínez | 8803b6c | 2022-10-17 00:36:38 +0200 | [diff] [blame] | 37 | addDialog = createRef(); |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 38 | |
Adrià Vilanova Martínez | 7f1e8ea | 2022-10-14 15:50:11 +0200 | [diff] [blame] | 39 | constructor() { |
| 40 | super(); |
| 41 | this._workflows = undefined; |
Adrià Vilanova Martínez | 0caffdd | 2022-10-17 19:40:35 +0200 | [diff] [blame] | 42 | WorkflowsStorage.watch(workflows => { |
| 43 | this._workflows = workflows; |
| 44 | this.requestUpdate(); |
| 45 | }, /* asProtobuf = */ true); |
Adrià Vilanova Martínez | 7f1e8ea | 2022-10-14 15:50:11 +0200 | [diff] [blame] | 46 | } |
| 47 | |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 48 | render() { |
| 49 | return html` |
| 50 | <h1>Workflows</h1> |
Adrià Vilanova Martínez | 7f1e8ea | 2022-10-14 15:50:11 +0200 | [diff] [blame] | 51 | <p>Workflows allow you to run a customized list of actions on a thread easily.</p> |
| 52 | <wf-list .workflows=${this._workflows}></wf-list> |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 53 | <md-fab ${ref(this.addFabRef)} |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 54 | @click=${this._showAddDialog}> |
Renovate bot | aa5fb8e | 2024-02-25 18:10:09 +0000 | [diff] [blame] | 55 | <md-icon slot="icon">add</md-icon> |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 56 | </md-fab> |
Adrià Vilanova Martínez | 8803b6c | 2022-10-17 00:36:38 +0200 | [diff] [blame] | 57 | <wf-add-dialog ${ref(this.addDialog)}> |
| 58 | </wf-add-dialog> |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 59 | `; |
| 60 | } |
| 61 | |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 62 | _showAddDialog() { |
Adrià Vilanova Martínez | 8803b6c | 2022-10-17 00:36:38 +0200 | [diff] [blame] | 63 | this.addDialog.value.open = true; |
Adrià Vilanova Martínez | f276ac7 | 2022-10-13 22:16:22 +0200 | [diff] [blame] | 64 | } |
| 65 | } |
| 66 | window.customElements.define('wf-app', WFApp); |