All files / app/mods/org kanban.ts

100% Statements 3/3
100% Branches 0/0
100% Functions 0/0
100% Lines 3/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286117x         117x                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     117x          
import { DateTime } from 'luxon';
import { Mod } from '../../model/tag';
import { Template } from '../../model/template';
import { RootConfig } from '../root';
 
export const kanbanTemplate: Template = {
  tag: 'kanban',
  name: $localize`📋️ Kanban`,
  config: {
    mod: $localize`📋️ Kanban`,
    version: 1,
    type: 'lens',
    default: true,
    generated: $localize`Generated by jasper-ui ${DateTime.now().toISO()}`,
    submit: $localize`📋️ kanban/`,
    view: $localize`📋️`,
    description: $localize`Activates built-in Kanban mode for viewing Refs.`,
    aiInstructions: `# kanban
    The kanban Template is used to organize Refs on a kanban board. The kanban Ext
    will customize what tags are used for columns, swim lanes and, badges.
    You may have been given the Ext as context, in which case it is easier to determine correct tag names.
    A user may ask you to add something to a kanban board such as kanban/testing.
    This means you should add the kanban/testing tag to the Ref you are adding.
    A user may also specifies a column. For example: add "fix mac" to the testing kanban
    and assign it to chris. This means you should create a ticket with a blank title and
    then comment "Fix Mac" with tags kanban/testing and assigned/chris.
 
    Since templates are hierarchical, kanbans are also hierarchical. This means if
    you add a Ref to kanban/a/b, it may also show up on kanban/a. Whether it actually
    shows up or not depends on the kanban's columns, swim lanes and badges.`,
    icons: [{ thumbnail: $localize`📋️`, order: 1 }],
    filters: [
      { query: 'kanban', label: $localize`📋️ kanban`, title: $localize`Kanban Boards`, group: $localize`Templates 🎨️` },
    ],
    // language=CSS
    css: `
      body.light-theme {
        .kanban {
          .column-title, .swim-lane-title {
            background-color: transparent;
            backdrop-filter: blur(1px) sepia(5%);
            border: 0.5px solid var(--border-light);
            &:hover {
              box-shadow: 0 0 4px rgba(0, 0, 0, 0.2);
            }
          }
        }
      }
      body.dark-theme {
        .kanban {
          .column-title, .swim-lane-title {
            background-color: var(--bg-accent);
            backdrop-filter: blur(1px);
            box-shadow: 0 0 2px 1px rgba(0, 0, 0, 0.1);
            &:hover {
              box-shadow: 0 0 4px rgba(0, 0, 0, 0.2),
              0 0 1px rgba(255, 255, 255, 0.5);
            }
          }
        }
        .kanban-card {
          &.cdk-drag-preview {
            background-color: var(--card-dragging);
          }
        }
      }
      .kanban {
        padding: 4px;
        grid-gap: 8px;
        .column-title {
          justify-self: center;
          width: calc(100% - 32px);
        }
        .column-title, .swim-lane-title {
          margin: 8px 0;
          padding: 4px;
          border-radius: 12px !important;
          font-weight: bold;
          text-align: center;
          transform: scale(1);
          transform-origin: center;
          transition: transform 0.1s cubic-bezier(.47,1.64,.8,1.2);
          &:hover {
            z-index: 1;
            transform: scale(1.01);
          }
        }
        .kanban-column {
          justify-self: center;
          border: 1px solid transparent;
          &:hover {
            border: 1px dashed var(--border);
          }
        }
        .kanban-header {
          margin-top: 8px;
          .kanban-remove {
            border-radius: 4px;
            background-color: var(--placeholder);
          }
          &.cdk-drop-list-dragging {
            .kanban-remove {
              background-color: var(--deleting);
            }
          }
          .cdk-drag-placeholder {
            display: none;
          }
        }
      }
      .kanban-card-container,
      .note-container {
        .row * {
          align-self: center;
        }
      }
      .kanban-card,
      .note {
        padding: 4px;
        margin-top: 2px;
        border-radius: 4px;
        background-color: var(--card);
        .plugin_thread .toggle {
          background-color: var(--toggle-accent);
        }
        .md p {
          text-align: left;
        }
      }
      .kanban-card {
        &.unlocked {
          border-radius: 5px;
          border: 0.25px dashed var(--border-accent);
        }
        &:hover {
          filter: drop-shadow(0 0 0.5px var(--border));
        }
        &.cdk-drag-placeholder {
          background-color: var(--placeholder);
        }
        &.no-write {
          cursor: no-drop !important;
 
          &.cdk-drag-preview {
            pointer-events: auto !important;
            cursor: no-drop !important;
            * {
              pointer-events: none !important;
            }
          }
        }
        transform: scale(1);
        transform-origin: center;
        transition: transform 0.1s cubic-bezier(.47,1.64,.8,1.2);
        &.unlocked {
          z-index: 1;
          transform: scale(1.05);
        }
        &:hover {
          z-index: 1;
          transform: scale(1.01);
        }
        &:not(.no-write) {
          cursor: grab;
        }
        .card-title, .thumbnail {
          margin-bottom: 4px;
        }
        &.cdk-drag-preview {
          transition: transform 0s;
          box-shadow: 0 5px 5px -3px rgba(0, 0, 0, 0.2),
          0 8px 10px 1px rgba(0, 0, 0, 0.14),
          0 3px 14px 2px rgba(0, 0, 0, 0.12);
        }
        &.cdk-drag-placeholder {
          transition: transform 0s;
          * {
            visibility: hidden !important;
          }
        }
      }
    `,
    form: [{
      key: 'columns',
      className: 'columns',
      type: 'tags',
      props: {
        label: $localize`Columns:`,
        addText: $localize`+ Add another column`,
      }
    }, {
      key: 'showColumnBacklog',
      type: 'boolean',
      props: {
        label: $localize`Show Columns Backlog:`
      }
    }, {
      key: 'columnBacklogTitle',
      type: 'string',
      props: {
        label: $localize`Column Backlog Title:`
      },
      expressions: {
        hide: '!field.parent.model.showColumnBacklog'
      },
    }, {
      key: 'swimLanes',
      className: 'swim-lanes',
      type: 'tags',
      props: {
        label: $localize`Swim Lanes:`,
        addText: $localize`+ Add another swim lane`,
      }
    }, {
      key: 'showSwimLaneBacklog',
      type: 'boolean',
      props: {
        label: $localize`Show Swim Lane Backlog:`
      },
      expressions: {
        hide: '!model.swimLanes || !model.swimLanes[0]'
      },
    }, {
      key: 'swimLaneBacklogTitle',
      type: 'string',
      props: {
        label: $localize`Swim Lane Backlog Title:`
      },
      expressions: {
        hide: '!model.swimLanes || !model.swimLanes[0] || !model.showSwimLaneBacklog'
      },
    }, {
      key: 'hideSwimLanes',
      type: 'boolean',
      props: {
        label: $localize`Hide Swim Lanes by Default:`
      },
      expressions: {
        hide: '!model.swimLanes || !model.swimLanes[0]'
      },
    }, {
      key: 'badges',
      className: 'badges',
      type: 'tags',
      props: {
        label: $localize`Badges:`,
        addText: $localize`+ Add another badge tag`,
      }
    }]
  },
  defaults: <KanbanConfig> {
    defaultSort: ['metadata->modified'],
    submitText: true,
    badges: ['p1', 'p2', 'p3', 'p4', 'p5']
  },
  schema: {
    optionalProperties: {
      columns: { elements: { type: 'string' } },
      showColumnBacklog: { type: 'boolean'},
      columnBacklogTitle: { type: 'string'},
      swimLanes: { elements: { type: 'string' } },
      hideSwimLanes: { type: 'boolean'},
      showSwimLaneBacklog: { type: 'boolean'},
      swimLaneBacklogTitle: { type: 'string'},
      badges: { elements: { type: 'string' } },
    },
  },
};
 
export interface KanbanConfig extends RootConfig {
  columns?: string[];
  showColumnBacklog?: boolean;
  columnBacklogTitle?: string;
  swimLanes?: string[];
  hideSwimLanes?: boolean;
  showSwimLaneBacklog?: boolean;
  swimLaneBacklogTitle?: string;
  badges?: string[];
}
 
export const kanbanMod: Mod = {
   template: [
    kanbanTemplate,
  ],
};