~hokiegeek/tw5-location-crafts

ref: 30bafff33c5ec04e44417c01c66f68860d0c94c0 tw5-location-crafts/macros.tid -rw-r--r-- 3.5 KiB
30bafff3HokieGeek Can now add to the list easily 7 months ago
                                                                                
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
modified: 20220214203551000
created: 20220214180052000
creator: hokiegeek
title: $:/plugins/hokiegeek/location-crafts/macros
tags: $:/tags/Macro
type: text/vnd.tiddlywiki

<!--
expected
random
special
complete (just for locations?)
none

how to mark uniques?
and how to mark them off?
-->

\define category-list(type)
<div class="category-list">
    <$let categoryState={{{ [{!!title}encodeuricomponent[]addprefix[$:/state/location-crafts/]] }}}>
    <div class="header-button">
        <h1 style="text-transform: capitalize;">$type$</h1>
        <$button setTitle=<<categoryState>> setField=$type$ setTo="visible" tooltip="Add $type$" aria-label="Add $type$" class="tc-btn-invisible tc-btn-mini">
            {{$:/core/images/new-button}}
        </$button>
    </div>
    <ol>
        <$let me={{!!title}}>
        <$list filter="[is[current]get[crafted-$type$]enlist-input:raw[]]" counter="counter" emptyMessage="no $type$ setup">
        <li>
            <<currentTiddler>>
            <!--
            <$let prev={{{ [<counter>subtract[1]] }}}
                  last={{{ [<me>get[crafted-$type$]enlist-input:raw[]rest<counter>join[ ]] }}}
                  newlist={{{ [<me>get[crafted-$type$]enlist-input:raw[]first<prev>append<last>join[ ]] }}}>
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="use unique" aria-label="use unique" class="tc-btn-invisible tc-btn-mini btn-close">
                <$action-setfield $tiddler=<<me>> $field="crafted-$type$" $value=<<newlist>> />
                {{$:/core/images/erase}}
            </$button>
            </$let>
            -->
        </li>
        </$list>
        </$let>
        <$reveal type="match" stateTitle=<<categoryState>> stateField=$type$ text="visible">
        <li>
        <div style="display: grid; width: fit-content;">
            <div style="grid-row-start: 1; grid-column-start: 1; padding-right: .3rem;">
            <$edit-text tiddler=<<categoryState>> field="custom-$type$" focus="true" />
            </div>
            <div style="grid-row-start: 1; grid-column-start: 2; padding-right: .2rem;">
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="cancel" aria-label="cancel" class="tc-btn-invisible tc-btn-mini">
                <$action-setfield $tiddler=<<categoryState>> $field="custom-$type$" $value="" />
                {{$:/core/images/close-button}}
            </$button>
            </div>
            <div style="grid-row-start: 1; grid-column-start: 3;">
            <$button setTitle=<<categoryState>> setField=$type$ setTo="hidden" tooltip="submit" aria-label="submit" class="tc-btn-invisible tc-btn-mini">
                <$let custom-element={{{ [<categoryState>get[custom-$type$]] }}}
                      updated-list={{{ [is[current]get[crafted-$type$]enlist-input:raw[]append<custom-element>join[ ]] }}}>
                <$action-setfield $tiddler=<<currentTiddler>> $field="crafted-$type$" $value=<<updated-list>> />
                </$let>
                <$action-setfield $tiddler=<<categoryState>> $field="custom-$type$" $value="" />
                {{$:/core/images/done-button}}
            </$button>
            </div>
            <!--
            <div style="grid-row-start: 2">
                <$list filter="[[expected random special complete none]enlist-input[]]">
                <<currentTiddler>><br />
                </$list>
            </div>
            -->
        </div>
        </li>
        </$reveal>
    </ol>
    </$let>
</div>
\end