Skip to main content

max / makenotwork

5.3 KB · 117 lines History Blame Raw
1 {% if purchases.is_empty() %}
2 <div class="content-section">
3 <p class="muted">No purchases yet.</p>
4 <p class="mt-4">
5 <a href="/discover" class="btn-primary library-tab-cta">Discover Content</a>
6 </p>
7 </div>
8 {% else %}
9 <div class="content-section scroll-x">
10 <div class="library-filter-wrap">
11 <input type="search" id="library-search" placeholder="Filter by title or creator..."
12 autocomplete="off"
13 class="library-filter-input input--sm w-full maxw-320"
14 oninput="(function(q){var rows=document.querySelectorAll('#library-table tbody tr');q=q.toLowerCase();rows.forEach(function(r){r.classList.toggle('hidden', r.textContent.toLowerCase().indexOf(q)===-1);});})(this.value)">
15 </div>
16 <table class="data-table minw-500" id="library-table">
17 <thead>
18 <tr>
19 <th>Title</th>
20 <th>Creator</th>
21 <th>Type</th>
22 <th>Added</th>
23 <th></th>
24 </tr>
25 </thead>
26 <tbody>
27 {% for item in purchases %}
28 <tr id="library-row-{{ item.item_id }}">
29 <td>
30 <a href="/l/{{ item.item_id }}" class="library-title-link">{{ item.title }}</a>
31 {% if item.has_new_version %}<span class="badge badge-new" title="New version available">New</span>{% endif %}
32 </td>
33 <td><a href="/u/{{ item.creator }}">{{ item.creator }}</a></td>
34 <td><span class="badge">{{ item.item_type }}</span></td>
35 <td>
36 {{ item.purchased_at.format("%b %d, %Y") }}
37 {% if let Some(key_code) = item.license_key_code %}
38 <div class="license-key-inline">
39 <code class="key-code-small" title="Click to copy" onclick="navigator.clipboard.writeText('{{ key_code }}'); this.textContent='Copied!'; setTimeout(() => this.textContent='{{ key_code }}', 1500)">{{ key_code }}</code>
40 </div>
41 {% endif %}
42 </td>
43 <td>
44 <div class="library-row-actions">
45 <a href="/l/{{ item.item_id }}" class="btn-secondary library-row-open">Open</a>
46 <div class="context-menu-wrapper">
47 <button class="context-menu-btn" onclick="toggleContextMenu(event, '{{ item.item_id }}')" title="More actions">...</button>
48 <div class="context-menu" id="menu-{{ item.item_id }}">
49 <a href="/receipt/{{ item.transaction_id }}" class="context-menu-item">View receipt</a>
50 <button class="context-menu-item collection-picker-anchor"
51 data-collection-trigger data-item-id="{{ item.item_id }}"
52 onclick="openCollectionPicker('{{ item.item_id }}', this)">Add to collection</button>
53 {% if item.is_free %}
54 <button class="context-menu-item btn-danger"
55 hx-delete="/api/library/remove/{{ item.item_id }}"
56 hx-target="#library-row-{{ item.item_id }}"
57 hx-swap="outerHTML"
58 hx-confirm="Remove this item from your library?">
59 Remove from library
60 </button>
61 {% endif %}
62 </div>
63 </div>
64 </div>
65 </td>
66 </tr>
67 {% endfor %}
68 </tbody>
69 </table>
70 </div>
71 {% endif %}
72
73 <script>
74 function toggleContextMenu(event, itemId) {
75 event.stopPropagation();
76 var menu = document.getElementById('menu-' + itemId);
77 var wasOpen = menu.classList.contains('open');
78 document.querySelectorAll('.context-menu').forEach(function(m) { m.classList.remove('open'); });
79 if (!wasOpen) { menu.classList.add('open'); }
80 }
81 document.addEventListener('click', function(e) {
82 document.querySelectorAll('.context-menu').forEach(function(m) { m.classList.remove('open'); });
83 });
84 </script>
85
86 <h2 class="library-tab-subheading">Memberships</h2>
87 {% if subscriptions.is_empty() %}
88 <div class="content-section">
89 <p class="muted">No active memberships. Some creators offer monthly memberships from their project page.</p>
90 </div>
91 {% else %}
92 <div class="content-section scroll-x">
93 <table class="data-table minw-500">
94 <thead>
95 <tr>
96 <th>Project</th>
97 <th>Tier</th>
98 <th>Price</th>
99 <th>Status</th>
100 <th>Renews</th>
101 </tr>
102 </thead>
103 <tbody>
104 {% for sub in subscriptions %}
105 <tr>
106 <td><a href="/p/{{ sub.project_slug }}">{{ sub.project_title }}</a></td>
107 <td>{{ sub.tier_name }}</td>
108 <td>{{ sub.price }}</td>
109 <td><span class="badge {{ sub.status }}">{{ sub.status }}</span></td>
110 <td>{{ sub.current_period_end.as_deref().unwrap_or("-") }}</td>
111 </tr>
112 {% endfor %}
113 </tbody>
114 </table>
115 </div>
116 {% endif %}
117