alterzick commited on
Commit
3392964
·
verified ·
1 Parent(s): 5a18626

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +1076 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Trading Dictionary
3
- emoji: 📉
4
- colorFrom: yellow
5
  colorTo: red
6
  sdk: static
7
  pinned: false
 
 
8
  ---
9
 
10
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: trading-dictionary
3
+ emoji: ⚛️
4
+ colorFrom: gray
5
  colorTo: red
6
  sdk: static
7
  pinned: false
8
+ tags:
9
+ - QwenSite
10
  ---
11
 
12
+ Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
index.html CHANGED
@@ -1,19 +1,1076 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Trading Dictionary App</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/xlsx/0.18.5/xlsx.full.min.js"></script>
9
+ <link href="https://cdn.jsdelivr.net/npm/daisyui@3.9.4/dist/full.css" rel="stylesheet" type="text/css" />
10
+ <script src="https://kit.fontawesome.com/1f7e5e05ce.js" crossorigin="anonymous"></script>
11
+ <script>
12
+ tailwind.config = {
13
+ theme: {
14
+ extend: {
15
+ colors: {
16
+ 'trading-green': '#00c853',
17
+ 'trading-red': '#d50000',
18
+ 'trading-blue': '#0077ff',
19
+ 'trading-bg': '#1a2a4a',
20
+ 'trading-panel': '#1e2d4d',
21
+ 'trading-dark': '#162447'
22
+ }
23
+ }
24
+ }
25
+ }
26
+ </script>
27
+ </head>
28
+ <body class="bg-trading-bg min-h-screen text-gray-200">
29
+ <div class="container mx-auto px-4 py-8">
30
+ <!-- Header -->
31
+ <header class="text-center mb-10">
32
+ <h1 class="text-4xl font-bold mb-2">
33
+ <i class="fas fa-exchange-alt mr-3 text-trading-green"></i>Trading Dictionary
34
+ </h1>
35
+ <p class="text-gray-300">Master trading terminology with this comprehensive dictionary</p>
36
+ </header>
37
+
38
+ <!-- Main Tabs -->
39
+ <div class="tabs tabs-lifted w-full max-w-6xl mx-auto mb-6 bg-trading-dark rounded-lg overflow-hidden">
40
+ <a class="tab tab-lg" id="input-tab">➕ Add Term</a>
41
+ <a class="tab tab-lg" id="search-tab">🔍 Search</a>
42
+ <a class="tab tab-lg" id="records-tab">📊 Terms List</a>
43
+ <a class="tab tab-lg" id="import-tab">📤 Import/Export</a>
44
+ </div>
45
+
46
+ <!-- Input Tab Content -->
47
+ <div id="input-content" class="tab-content bg-trading-panel rounded-xl shadow-xl p-8 mb-8 transition-all duration-300">
48
+ <h2 class="text-2xl font-semibold mb-6 flex items-center text-white">
49
+ <i class="fas fa-plus-circle mr-3 text-trading-green"></i>Add New Trading Term
50
+ </h2>
51
+ <form id="dictionary-form" class="space-y-6">
52
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-6">
53
+ <div class="form-control">
54
+ <label class="label">
55
+ <span class="label-text font-medium text-gray-200">Term</span>
56
+ <span class="label-text-alt text-red-400">*</span>
57
+ </label>
58
+ <input type="text" id="term" placeholder="Enter trading term" class="input input-bordered input-primary w-full bg-gray-800 border-gray-600 text-white" required />
59
+ </div>
60
+
61
+ <div class="form-control">
62
+ <label class="label">
63
+ <span class="label-text font-medium text-gray-200">Category</span>
64
+ </label>
65
+ <select id="category" class="select select-bordered select-primary w-full bg-gray-800 border-gray-600 text-white">
66
+ <option value="">Select category...</option>
67
+ <option value="technical-analysis">Technical Analysis</option>
68
+ <option value="fundamental-analysis">Fundamental Analysis</option>
69
+ <option value="trading-strategy">Trading Strategy</option>
70
+ <option value="risk-management">Risk Management</option>
71
+ <option value="market-structure">Market Structure</option>
72
+ <option value="indicators">Indicators</option>
73
+ <option value="candlestick-patterns">Candlestick Patterns</option>
74
+ <option value="crypto-trading">Crypto Trading</option>
75
+ <option value="options-trading">Options Trading</option>
76
+ </select>
77
+ </div>
78
+ </div>
79
+
80
+ <div class="form-control">
81
+ <label class="label">
82
+ <span class="label-text font-medium text-gray-200">Definition</span>
83
+ <span class="label-text-alt text-red-400">*</span>
84
+ </label>
85
+ <textarea id="definition" placeholder="Enter definition" class="textarea textarea-bordered textarea-primary h-24 bg-gray-800 border-gray-600 text-white" required></textarea>
86
+ </div>
87
+
88
+ <div class="form-control">
89
+ <label class="label">
90
+ <span class="label-text font-medium text-gray-200">How to Use / Application</span>
91
+ </label>
92
+ <textarea id="application" placeholder="Describe how this term is used in trading" class="textarea textarea-bordered textarea-primary h-24 bg-gray-800 border-gray-600 text-white"></textarea>
93
+ </div>
94
+
95
+ <div class="form-control">
96
+ <label class="label">
97
+ <span class="label-text font-medium text-gray-200">Method / Implementation</span>
98
+ </label>
99
+ <textarea id="method" placeholder="Explain the method or implementation details" class="textarea textarea-bordered textarea-primary h-24 bg-gray-800 border-gray-600 text-white"></textarea>
100
+ </div>
101
+
102
+ <div class="form-control">
103
+ <label class="label">
104
+ <span class="label-text font-medium text-gray-200">Example</span>
105
+ </label>
106
+ <textarea id="example" placeholder="Provide an example of how this term is applied" class="textarea textarea-bordered textarea-primary h-24 bg-gray-800 border-gray-600 text-white"></textarea>
107
+ </div>
108
+
109
+ <div class="form-control">
110
+ <label class="label">
111
+ <span class="label-text font-medium text-gray-200">Synonyms / Related Terms</span>
112
+ </label>
113
+ <input type="text" id="synonyms" placeholder="Comma separated related terms" class="input input-bordered input-primary w-full bg-gray-800 border-gray-600 text-white" />
114
+ </div>
115
+
116
+ <div class="flex flex-wrap gap-4 pt-4">
117
+ <button type="submit" class="btn btn-primary btn-lg flex-1 md:flex-none bg-trading-green hover:bg-green-600 border-0 text-white">
118
+ <i class="fas fa-save mr-2"></i>Save Term
119
+ </button>
120
+ <button type="button" id="clear-form" class="btn btn-outline btn-lg flex-1 md:flex-none border-gray-500 text-gray-300 hover:bg-gray-700 hover:border-gray-400">
121
+ <i class="fas fa-times mr-2"></i>Clear
122
+ </button>
123
+ </div>
124
+ </form>
125
+ </div>
126
+
127
+ <!-- Search Tab Content -->
128
+ <div id="search-content" class="tab-content bg-trading-panel rounded-xl shadow-xl p-8 mb-8 hidden transition-all duration-300">
129
+ <h2 class="text-2xl font-semibold mb-6 flex items-center text-white">
130
+ <i class="fas fa-search mr-3 text-trading-blue"></i>Search Trading Terms
131
+ </h2>
132
+
133
+ <div class="form-control mb-6">
134
+ <label class="label">
135
+ <span class="label-text font-medium text-gray-200">Search Term</span>
136
+ </label>
137
+ <div class="relative">
138
+ <input type="text" id="search-input" placeholder="Search for terms, definitions, applications..." class="input input-bordered input-primary w-full pr-12 bg-gray-800 border-gray-600 text-white" />
139
+ <button id="search-btn" class="btn btn-square btn-ghost absolute right-1 top-1 border-0 hover:bg-gray-700 text-trading-blue">
140
+ <i class="fas fa-search"></i>
141
+ </button>
142
+ </div>
143
+ </div>
144
+
145
+ <div class="form-control mb-6">
146
+ <div class="flex flex-wrap gap-2">
147
+ <label class="label cursor-pointer">
148
+ <span class="label-text text-gray-200">Category: </span>
149
+ </label>
150
+ <select id="search-category" class="select select-sm select-bordered bg-gray-800 border-gray-600 text-gray-200">
151
+ <option value="">All Categories</option>
152
+ <option value="technical-analysis">Technical Analysis</option>
153
+ <option value="fundamental-analysis">Fundamental Analysis</option>
154
+ <option value="trading-strategy">Trading Strategy</option>
155
+ <option value="risk-management">Risk Management</option>
156
+ <option value="market-structure">Market Structure</option>
157
+ <option value="indicators">Indicators</option>
158
+ <option value="candlestick-patterns">Candlestick Patterns</option>
159
+ <option value="crypto-trading">Crypto Trading</option>
160
+ <option value="options-trading">Options Trading</option>
161
+ </select>
162
+ </div>
163
+ </div>
164
+
165
+ <div id="search-results" class="mt-6 space-y-4"></div>
166
+ </div>
167
+
168
+ <!-- Records Tab Content -->
169
+ <div id="records-content" class="tab-content bg-trading-panel rounded-xl shadow-xl p-8 mb-8 hidden transition-all duration-300">
170
+ <h2 class="text-2xl font-semibold mb-6 flex items-center text-white">
171
+ <i class="fas fa-database mr-3 text-purple-400"></i>All Trading Terms
172
+ <span id="record-count" class="badge badge-primary ml-3 bg-trading-green text-white"></span>
173
+ </h2>
174
+
175
+ <div class="overflow-x-auto">
176
+ <table id="records-table" class="table table-zebra w-full">
177
+ <thead>
178
+ <tr class="text-gray-300">
179
+ <th class="text-white">Term</th>
180
+ <th class="text-white">Category</th>
181
+ <th class="text-white">Definition</th>
182
+ <th class="text-white">Actions</th>
183
+ </tr>
184
+ </thead>
185
+ <tbody></tbody>
186
+ </table>
187
+ </div>
188
+ </div>
189
+
190
+ <!-- Import/Export Tab Content -->
191
+ <div id="import-content" class="tab-content bg-trading-panel rounded-xl shadow-xl p-8 hidden transition-all duration-300">
192
+ <h2 class="text-2xl font-semibold mb-6 flex items-center text-white">
193
+ <i class="fas fa-file-import mr-3 text-orange-400"></i>Import/Export Data
194
+ </h2>
195
+
196
+ <div class="grid grid-cols-1 lg:grid-cols-2 gap-8">
197
+ <!-- Import Section -->
198
+ <div class="p-6 border-2 border-dashed border-trading-blue rounded-xl bg-opacity-50 bg-trading-dark">
199
+ <h3 class="text-xl font-semibold mb-4 text-trading-blue flex items-center">
200
+ <i class="fas fa-upload mr-3"></i>Import Data
201
+ </h3>
202
+ <p class="text-gray-300 mb-4">Import your trading dictionary data from Excel (XLS/XLSX) file.</p>
203
+
204
+ <div class="form-control">
205
+ <label class="label">
206
+ <span class="label-text text-gray-200">Upload Excel File</span>
207
+ </label>
208
+ <input type="file" id="import-file" accept=".xlsx, .xls" class="file-input file-input-bordered w-full bg-gray-800 border-gray-500 text-gray-200" />
209
+ </div>
210
+
211
+ <button id="import-btn" class="btn btn-primary mt-4 w-full bg-trading-blue hover:bg-blue-600 border-0 text-white">
212
+ <i class="fas fa-download mr-2"></i>Import Data
213
+ </button>
214
+
215
+ <div class="mt-4 text-sm text-gray-400">
216
+ <p><strong>File format requirements:</strong></p>
217
+ <ul class="list-disc list-inside mt-1">
218
+ <li>Must be in XLS or XLSX format</li>
219
+ <li>First row should contain headers: Term, Category, Definition, Application, Method, Example, Synonyms</li>
220
+ <li>All fields except "Application", "Method", "Example" and "Synonyms" are required</li>
221
+ </ul>
222
+ </div>
223
+ </div>
224
+
225
+ <!-- Export Section -->
226
+ <div class="p-6 border-2 border-dashed border-trading-green rounded-xl bg-opacity-50 bg-trading-dark">
227
+ <h3 class="text-xl font-semibold mb-4 text-trading-green flex items-center">
228
+ <i class="fas fa-download mr-3"></i>Export Data
229
+ </h3>
230
+ <p class="text-gray-300 mb-4">Export your trading dictionary data to Excel for backup or sharing.</p>
231
+
232
+ <button id="export-btn" class="btn btn-success w-full text-lg py-4 bg-trading-green hover:bg-green-600 border-0 text-white">
233
+ <i class="fas fa-file-excel mr-2"></i>Export to Excel
234
+ </button>
235
+
236
+ <div class="mt-4 text-sm text-gray-400">
237
+ <p><strong>Export options:</strong></p>
238
+ <ul class="list-disc list-inside mt-1">
239
+ <li>Exports all trading dictionary entries</li>
240
+ <li>Creates an XLSX file compatible with Excel and Google Sheets</li>
241
+ <li>Includes all data fields</li>
242
+ </ul>
243
+ </div>
244
+ </div>
245
+ </div>
246
+
247
+ <div class="mt-8 p-4 bg-yellow-900 bg-opacity-30 border-l-4 border-yellow-500 rounded">
248
+ <p class="text-sm text-yellow-200 flex items-start">
249
+ <i class="fas fa-exclamation-triangle mr-2 mt-1"></i>
250
+ <strong>Warning:</strong> Importing a new file will overwrite any existing entries with the same terms. Please backup your data before importing.
251
+ </p>
252
+ </div>
253
+ </div>
254
+
255
+ <!-- Toast Notification -->
256
+ <div id="toast" class="toast toast-top toast-end hidden">
257
+ <div id="toast-content" class="alert rounded-lg shadow-lg">
258
+ <span id="toast-message"></span>
259
+ </div>
260
+ </div>
261
+
262
+ <!-- Detail Modal -->
263
+ <input type="checkbox" id="detail-modal" class="modal-toggle" />
264
+ <div class="modal modal-bottom sm:modal-middle">
265
+ <div class="modal-box bg-trading-panel max-w-3xl">
266
+ <h3 id="detail-modal-title" class="font-bold text-xl mb-4 text-trading-green"></h3>
267
+ <div id="detail-content" class="space-y-4 text-gray-200">
268
+ <!-- Content will be filled dynamically -->
269
+ </div>
270
+ <div class="modal-action">
271
+ <label for="detail-modal" class="btn bg-gray-700 hover:bg-gray-600 border-0 text-white">Close</label>
272
+ </div>
273
+ </div>
274
+ </div>
275
+
276
+ <!-- Edit Modal -->
277
+ <input type="checkbox" id="edit-modal" class="modal-toggle" />
278
+ <div class="modal modal-bottom sm:modal-middle">
279
+ <div class="modal-box bg-trading-panel max-w-3xl">
280
+ <h3 id="edit-modal-title" class="font-bold text-xl mb-4 text-trading-green">Edit Entry</h3>
281
+ <form id="edit-form" class="space-y-4">
282
+ <input type="hidden" id="edit-id" />
283
+ <div class="grid grid-cols-1 md:grid-cols-2 gap-4">
284
+ <div class="form-control">
285
+ <label class="label">
286
+ <span class="label-text font-medium text-gray-200">Term</span>
287
+ </label>
288
+ <input type="text" id="edit-term" class="input input-bordered input-primary w-full bg-gray-800 border-gray-600 text-white" required />
289
+ </div>
290
+
291
+ <div class="form-control">
292
+ <label class="label">
293
+ <span class="label-text font-medium text-gray-200">Category</span>
294
+ </label>
295
+ <select id="edit-category" class="select select-bordered select-primary w-full bg-gray-800 border-gray-600 text-white">
296
+ <option value="">Select category...</option>
297
+ <option value="technical-analysis">Technical Analysis</option>
298
+ <option value="fundamental-analysis">Fundamental Analysis</option>
299
+ <option value="trading-strategy">Trading Strategy</option>
300
+ <option value="risk-management">Risk Management</option>
301
+ <option value="market-structure">Market Structure</option>
302
+ <option value="indicators">Indicators</option>
303
+ <option value="candlestick-patterns">Candlestick Patterns</option>
304
+ <option value="crypto-trading">Crypto Trading</option>
305
+ <option value="options-trading">Options Trading</option>
306
+ </select>
307
+ </div>
308
+ </div>
309
+
310
+ <div class="form-control">
311
+ <label class="label">
312
+ <span class="label-text font-medium text-gray-200">Definition</span>
313
+ </label>
314
+ <textarea id="edit-definition" class="textarea textarea-bordered textarea-primary h-20 bg-gray-800 border-gray-600 text-white" required></textarea>
315
+ </div>
316
+
317
+ <div class="form-control">
318
+ <label class="label">
319
+ <span class="label-text font-medium text-gray-200">How to Use / Application</span>
320
+ </label>
321
+ <textarea id="edit-application" class="textarea textarea-bordered textarea-primary h-20 bg-gray-800 border-gray-600 text-white"></textarea>
322
+ </div>
323
+
324
+ <div class="form-control">
325
+ <label class="label">
326
+ <span class="label-text font-medium text-gray-200">Method / Implementation</span>
327
+ </label>
328
+ <textarea id="edit-method" class="textarea textarea-bordered textarea-primary h-20 bg-gray-800 border-gray-600 text-white"></textarea>
329
+ </div>
330
+
331
+ <div class="form-control">
332
+ <label class="label">
333
+ <span class="label-text font-medium text-gray-200">Example</span>
334
+ </label>
335
+ <textarea id="edit-example" class="textarea textarea-bordered textarea-primary h-20 bg-gray-800 border-gray-600 text-white"></textarea>
336
+ </div>
337
+
338
+ <div class="form-control">
339
+ <label class="label">
340
+ <span class="label-text font-medium text-gray-200">Synonyms / Related Terms</span>
341
+ </label>
342
+ <input type="text" id="edit-synonyms" class="input input-bordered input-primary w-full bg-gray-800 border-gray-600 text-white" />
343
+ </div>
344
+
345
+ <div class="modal-action">
346
+ <button type="submit" class="btn btn-primary bg-trading-green hover:bg-green-600 border-0 text-white">Save Changes</button>
347
+ <label for="edit-modal" class="btn bg-gray-700 hover:bg-gray-600 border-0 text-white">Cancel</label>
348
+ </div>
349
+ </form>
350
+ </div>
351
+ </div>
352
+
353
+ <!-- Delete Confirmation Modal -->
354
+ <input type="checkbox" id="delete-modal" class="modal-toggle" />
355
+ <div class="modal">
356
+ <div class="modal-box bg-trading-panel">
357
+ <h3 id="delete-modal-title" class="font-bold text-xl text-red-400">Delete Confirmation</h3>
358
+ <p id="delete-modal-body" class="py-4 text-gray-300">Are you sure you want to delete this entry? This action cannot be undone.</p>
359
+ <div class="modal-action">
360
+ <button id="confirm-delete" class="btn btn-error text-white">Yes, Delete</button>
361
+ <label for="delete-modal" class="btn bg-gray-700 hover:bg-gray-600 border-0 text-white">Cancel</label>
362
+ </div>
363
+ </div>
364
+ </div>
365
+ </div>
366
+
367
+ <script>
368
+ // Trading Dictionary App Main Logic
369
+ document.addEventListener('DOMContentLoaded', function() {
370
+ // Initialize local storage if not exists
371
+ if (!localStorage.getItem('tradingDictionaryEntries')) {
372
+ // Load some default trading terms
373
+ const defaultTerms = [
374
+ {
375
+ id: 1,
376
+ term: "Support",
377
+ category: "technical-analysis",
378
+ definition: "A price level where a downtrend can be expected to pause due to a concentration of demand.",
379
+ application: "Support levels are used to identify potential entry points for long positions. Traders watch for price to bounce off support levels with confirmation from other indicators.",
380
+ method: "Identify support by examining previous price lows on a chart. Horizontal lines are drawn at these levels. Multiple touches of a support level increase its significance.",
381
+ example: "In the ETH/USD chart, $1,800 has acted as strong support three times in the past month, making it a high-probability bounce level.",
382
+ synonyms: "Floor, Demand zone"
383
+ },
384
+ {
385
+ id: 2,
386
+ term: "Resistance",
387
+ category: "technical-analysis",
388
+ definition: "A price level where an uptrend can be expected to pause due to a concentration of supply.",
389
+ application: "Resistance levels help identify potential take-profit points or entry points for short positions. They are often used in conjunction with overbought indicators.",
390
+ method: "Identify resistance by examining previous price highs on a chart. Draw horizontal lines at these levels. The more times price fails to break above a resistance level, the stronger it becomes.",
391
+ example: "For BTC/USD, $45,000 has been a strong resistance level, preventing price from moving higher on three separate occasions in the past two months.",
392
+ synonyms: "Ceiling, Supply zone"
393
+ },
394
+ {
395
+ id: 3,
396
+ term: "Moving Average",
397
+ category: "indicators",
398
+ definition: "An indicator that shows the average value of a security's price over a set period of time.",
399
+ application: "Used to identify trends, generate buy/sell signals, and determine support/resistance levels. Crossovers of different moving averages can signal trend changes.",
400
+ method: "Calculate by taking the average closing price over a specified number of periods. Common types include Simple Moving Average (SMA), Exponential Moving Average (EMA), and Weighted Moving Average (WMA).",
401
+ example: "A trader might use a 50-day EMA crossover above a 200-day EMA as a buy signal, indicating a potential bullish trend change.",
402
+ synonyms: "MA, Average"
403
+ },
404
+ {
405
+ id: 4,
406
+ term: "Risk/Reward Ratio",
407
+ category: "risk-management",
408
+ definition: "A measure of the potential profit of a trade compared to its potential loss.",
409
+ application: "Used to evaluate whether a trade is worth taking based on the potential return versus the potential risk. Helps traders maintain consistency in their trading approach.",
410
+ method: "Calculate by dividing the potential profit (distance from entry to take-profit) by the potential loss (distance from entry to stop-loss). A ratio of 2:1 means the potential profit is twice the potential risk.",
411
+ example: "A trader entering a position at $100 with a take-profit at $120 and a stop-loss at $90 has a risk/reward ratio of 2:1 (potential profit of $20 vs potential risk of $10).",
412
+ synonyms: "R:R, Profit/risk ratio"
413
+ }
414
+ ];
415
+ localStorage.setItem('tradingDictionaryEntries', JSON.stringify(defaultTerms));
416
+ }
417
+
418
+ // Tab functionality
419
+ const tabs = document.querySelectorAll('.tab');
420
+ const tabContents = document.querySelectorAll('.tab-content');
421
+
422
+ tabs.forEach(tab => {
423
+ tab.addEventListener('click', () => {
424
+ // Remove active class from all tabs and contents
425
+ tabs.forEach(t => t.classList.remove('tab-active'));
426
+ tabContents.forEach(content => content.classList.add('hidden'));
427
+
428
+ // Add active class to clicked tab and corresponding content
429
+ tab.classList.add('tab-active');
430
+ const tabId = tab.id.replace('-tab', '-content');
431
+ document.getElementById(tabId).classList.remove('hidden');
432
+
433
+ // Special handling for records tab - refresh table when shown
434
+ if (tabId === 'records-content') {
435
+ displayAllRecords();
436
+ } else if (tabId === 'search-content') {
437
+ // Clear search results when entering search tab
438
+ document.getElementById('search-results').innerHTML = '';
439
+ document.getElementById('search-input').value = '';
440
+ }
441
+ });
442
+ });
443
+
444
+ // Show input tab by default
445
+ document.getElementById('input-tab').click();
446
+
447
+ // Dictionary data functions
448
+ function getEntries() {
449
+ return JSON.parse(localStorage.getItem('tradingDictionaryEntries')) || [];
450
+ }
451
+
452
+ function saveEntries(entries) {
453
+ localStorage.setItem('tradingDictionaryEntries', JSON.stringify(entries));
454
+ }
455
+
456
+ function addEntry(entry) {
457
+ const entries = getEntries();
458
+ // Check if term already exists and update if it does
459
+ const existingIndex = entries.findIndex(e => e.term.toLowerCase() === entry.term.toLowerCase());
460
+ if (existingIndex > -1) {
461
+ entries[existingIndex] = { ...entries[existingIndex], ...entry };
462
+ } else {
463
+ entry.id = Date.now(); // Simple ID generation
464
+ entries.push(entry);
465
+ }
466
+ saveEntries(entries);
467
+ }
468
+
469
+ function updateEntry(id, updatedEntry) {
470
+ const entries = getEntries();
471
+ const index = entries.findIndex(e => e.id == id);
472
+ if (index > -1) {
473
+ entries[index] = { ...entries[index], ...updatedEntry };
474
+ saveEntries(entries);
475
+ }
476
+ }
477
+
478
+ function deleteEntry(id) {
479
+ let entries = getEntries();
480
+ entries = entries.filter(e => e.id != id);
481
+ saveEntries(entries);
482
+ }
483
+
484
+ function searchEntries(term, category = '', searchInAllFields = true) {
485
+ const entries = getEntries();
486
+ const searchTerm = term.toLowerCase();
487
+
488
+ return entries.filter(entry => {
489
+ // Check category filter first
490
+ if (category && entry.category !== category) {
491
+ return false;
492
+ }
493
+
494
+ if (entry.term.toLowerCase().includes(searchTerm)) {
495
+ return true;
496
+ }
497
+
498
+ if (searchInAllFields && entry.definition.toLowerCase().includes(searchTerm)) {
499
+ return true;
500
+ }
501
+
502
+ if (searchInAllFields && entry.application && entry.application.toLowerCase().includes(searchTerm)) {
503
+ return true;
504
+ }
505
+
506
+ if (searchInAllFields && entry.method && entry.method.toLowerCase().includes(searchTerm)) {
507
+ return true;
508
+ }
509
+
510
+ if (searchInAllFields && entry.example && entry.example.toLowerCase().includes(searchTerm)) {
511
+ return true;
512
+ }
513
+
514
+ if (searchInAllFields && entry.synonyms && entry.synonyms.toLowerCase().includes(searchTerm)) {
515
+ return true;
516
+ }
517
+
518
+ return false;
519
+ });
520
+ }
521
+
522
+ // Form submission
523
+ const dictionaryForm = document.getElementById('dictionary-form');
524
+ dictionaryForm.addEventListener('submit', function(e) {
525
+ e.preventDefault();
526
+
527
+ const entry = {
528
+ term: document.getElementById('term').value.trim(),
529
+ category: document.getElementById('category').value,
530
+ definition: document.getElementById('definition').value.trim(),
531
+ application: document.getElementById('application').value.trim(),
532
+ method: document.getElementById('method').value.trim(),
533
+ example: document.getElementById('example').value.trim(),
534
+ synonyms: document.getElementById('synonyms').value.trim()
535
+ };
536
+
537
+ // Validation
538
+ if (!entry.term) {
539
+ showNotification('Term is required', 'error');
540
+ return;
541
+ }
542
+
543
+ if (!entry.definition) {
544
+ showNotification('Definition is required', 'error');
545
+ return;
546
+ }
547
+
548
+ addEntry(entry);
549
+ showNotification('Trading term added successfully!', 'success');
550
+
551
+ // Reset form
552
+ dictionaryForm.reset();
553
+ });
554
+
555
+ // Clear form
556
+ document.getElementById('clear-form').addEventListener('click', function() {
557
+ dictionaryForm.reset();
558
+ });
559
+
560
+ // Search functionality
561
+ const searchBtn = document.getElementById('search-btn');
562
+ const searchInput = document.getElementById('search-input');
563
+ const searchCategory = document.getElementById('search-category');
564
+ const searchResults = document.getElementById('search-results');
565
+
566
+ function performSearch() {
567
+ const term = searchInput.value.trim();
568
+ const category = searchCategory.value;
569
+
570
+ if (!term && !category) {
571
+ searchResults.innerHTML = '<div class="alert alert-info text-gray-300 bg-gray-700 border-0">Enter a search term or select a category above.</div>';
572
+ return;
573
+ }
574
+
575
+ const results = searchEntries(term, category, true);
576
+
577
+ if (results.length === 0) {
578
+ searchResults.innerHTML = '<div class="alert alert-warning text-gray-300 bg-gray-700 border-0">No entries found matching your search.</div>';
579
+ return;
580
+ }
581
+
582
+ searchResults.innerHTML = `
583
+ <div class="alert alert-info mb-4 text-gray-300 bg-gray-700 border-0">
584
+ Found ${results.length} result${results.length !== 1 ? 's' : ''} ${term ? `for "${term}"` : ''}${term && category ? ' with' : category ? ' for' : ''} ${category ? `"${searchCategory.options[searchCategory.selectedIndex].text}" category` : ''}
585
+ </div>
586
+ ${results.map(renderEntryCard).join('')}
587
+ `;
588
+
589
+ // Add event listeners to view, edit and delete buttons
590
+ document.querySelectorAll('.view-btn').forEach(btn => {
591
+ btn.addEventListener('click', handleViewClick);
592
+ });
593
+
594
+ document.querySelectorAll('.edit-btn').forEach(btn => {
595
+ btn.addEventListener('click', handleEditClick);
596
+ });
597
+
598
+ document.querySelectorAll('.delete-btn').forEach(btn => {
599
+ btn.addEventListener('click', handleDeleteClick);
600
+ });
601
+ }
602
+
603
+ searchBtn.addEventListener('click', performSearch);
604
+ searchInput.addEventListener('keypress', function(e) {
605
+ if (e.key === 'Enter') {
606
+ performSearch();
607
+ }
608
+ });
609
+
610
+ searchCategory.addEventListener('change', performSearch);
611
+
612
+ // Display all records
613
+ function displayAllRecords() {
614
+ const entries = getEntries();
615
+ const tableBody = document.querySelector('#records-table tbody');
616
+ const recordCount = document.getElementById('record-count');
617
+
618
+ if (entries.length === 0) {
619
+ tableBody.innerHTML = `
620
+ <tr>
621
+ <td colspan="4" class="text-center py-8 text-gray-500">
622
+ <i class="fas fa-inbox text-4xl mb-2 opacity-50"></i>
623
+ <div>No entries yet. Start by adding your first trading term!</div>
624
+ </td>
625
+ </tr>
626
+ `;
627
+ recordCount.textContent = '0 entries';
628
+ return;
629
+ }
630
+
631
+ tableBody.innerHTML = entries.map(entry => {
632
+ const categoryLabel = {
633
+ 'technical-analysis': 'Technical',
634
+ 'fundamental-analysis': 'Fundamental',
635
+ 'trading-strategy': 'Strategy',
636
+ 'risk-management': 'Risk Mgmt',
637
+ 'market-structure': 'Market',
638
+ 'indicators': 'Indicators',
639
+ 'candlestick-patterns': 'Candlestick',
640
+ 'crypto-trading': 'Crypto',
641
+ 'options-trading': 'Options'
642
+ }[entry.category] || entry.category;
643
+
644
+ return `
645
+ <tr class="hover:bg-gray-700 transition-colors">
646
+ <td class="font-medium text-trading-green">${entry.term}</td>
647
+ <td>
648
+ <span class="badge bg-gray-700 border border-gray-600 text-xs">${categoryLabel}</span>
649
+ </td>
650
+ <td>${truncateText(entry.definition, 80)}</td>
651
+ <td>
652
+ <div class="join join-vertical md:join-horizontal">
653
+ <button class="btn btn-xs btn-outline join-item view-btn text-blue-400 border-gray-600 hover:bg-gray-700" data-id="${entry.id}">
654
+ <i class="fas fa-eye"></i>
655
+ </button>
656
+ <button class="btn btn-xs btn-outline join-item edit-btn text-green-400 border-gray-600 hover:bg-gray-700" data-id="${entry.id}">
657
+ <i class="fas fa-edit"></i>
658
+ </button>
659
+ <button class="btn btn-xs btn-outline join-item delete-btn text-red-400 border-gray-600 hover:bg-gray-700" data-id="${entry.id}">
660
+ <i class="fas fa-trash"></i>
661
+ </button>
662
+ </div>
663
+ </td>
664
+ </tr>
665
+ `;
666
+ }).join('');
667
+
668
+ recordCount.textContent = `${entries.length} entries`;
669
+
670
+ // Add event listeners to view, edit and delete buttons
671
+ document.querySelectorAll('.view-btn').forEach(btn => {
672
+ btn.addEventListener('click', handleViewClick);
673
+ });
674
+
675
+ document.querySelectorAll('.edit-btn').forEach(btn => {
676
+ btn.addEventListener('click', handleEditClick);
677
+ });
678
+
679
+ document.querySelectorAll('.delete-btn').forEach(btn => {
680
+ btn.addEventListener('click', handleDeleteClick);
681
+ });
682
+ }
683
+
684
+ // View entry
685
+ function handleViewClick(e) {
686
+ const entryId = e.target.closest('.view-btn').dataset.id;
687
+ const entries = getEntries();
688
+ const entry = entries.find(e => e.id == entryId);
689
+
690
+ // Fill the modal content
691
+ document.getElementById('detail-modal-title').textContent = entry.term;
692
+
693
+ const categoryLabels = {
694
+ 'technical-analysis': 'Technical Analysis',
695
+ 'fundamental-analysis': 'Fundamental Analysis',
696
+ 'trading-strategy': 'Trading Strategy',
697
+ 'risk-management': 'Risk Management',
698
+ 'market-structure': 'Market Structure',
699
+ 'indicators': 'Indicators',
700
+ 'candlestick-patterns': 'Candlestick Patterns',
701
+ 'crypto-trading': 'Crypto Trading',
702
+ 'options-trading': 'Options Trading'
703
+ };
704
+
705
+ const categoryLabel = categoryLabels[entry.category] || entry.category;
706
+
707
+ document.getElementById('detail-content').innerHTML = `
708
+ <div class="bg-gray-700 rounded-lg p-4">
709
+ <div class="flex justify-between items-start">
710
+ <div>
711
+ <span class="text-trading-blue font-medium">${categoryLabel}</span>
712
+ </div>
713
+ </div>
714
+
715
+ <div class="mt-3">
716
+ <h4 class="font-semibold text-trading-green text-lg mb-2">Definition</h4>
717
+ <p class="text-gray-200">${entry.definition}</p>
718
+ </div>
719
+
720
+ ${entry.application ? `
721
+ <div class="mt-4">
722
+ <h4 class="font-semibold text-trading-blue text-lg mb-2">How to Use / Application</h4>
723
+ <p class="text-gray-200">${entry.application}</p>
724
+ </div>` : ''}
725
+
726
+ ${entry.method ? `
727
+ <div class="mt-4">
728
+ <h4 class="font-semibold text-trading-blue text-lg mb-2">Method / Implementation</h4>
729
+ <p class="text-gray-200">${entry.method}</p>
730
+ </div>` : ''}
731
+
732
+ ${entry.example ? `
733
+ <div class="mt-4">
734
+ <h4 class="font-semibold text-trading-blue text-lg mb-2">Example</h4>
735
+ <p class="text-gray-200">${entry.example}</p>
736
+ </div>` : ''}
737
+
738
+ ${entry.synonyms ? `
739
+ <div class="mt-4">
740
+ <h4 class="font-semibold text-trading-blue text-lg mb-2">Synonyms / Related Terms</h4>
741
+ <div class="flex flex-wrap gap-2 mt-2">
742
+ ${entry.synonyms.split(',').map(synonym =>
743
+ `<span class="badge bg-gray-600 text-gray-200">${synonym.trim()}</span>`
744
+ ).join('')}
745
+ </div>
746
+ </div>` : ''}
747
+ </div>
748
+ `;
749
+
750
+ // Show modal
751
+ document.getElementById('detail-modal').checked = true;
752
+ }
753
+
754
+ // Edit entry
755
+ let currentEditId = null;
756
+
757
+ function handleEditClick(e) {
758
+ currentEditId = e.target.closest('.edit-btn').dataset.id;
759
+ const entries = getEntries();
760
+ const entry = entries.find(e => e.id == currentEditId);
761
+
762
+ // Fill the form
763
+ document.getElementById('edit-id').value = entry.id;
764
+ document.getElementById('edit-term').value = entry.term;
765
+ document.getElementById('edit-category').value = entry.category || '';
766
+ document.getElementById('edit-definition').value = entry.definition;
767
+ document.getElementById('edit-application').value = entry.application || '';
768
+ document.getElementById('edit-method').value = entry.method || '';
769
+ document.getElementById('edit-example').value = entry.example || '';
770
+ document.getElementById('edit-synonyms').value = entry.synonyms || '';
771
+
772
+ // Show modal
773
+ document.getElementById('edit-modal').checked = true;
774
+ }
775
+
776
+ document.getElementById('edit-form').addEventListener('submit', function(e) {
777
+ e.preventDefault();
778
+
779
+ const updatedEntry = {
780
+ term: document.getElementById('edit-term').value.trim(),
781
+ category: document.getElementById('edit-category').value,
782
+ definition: document.getElementById('edit-definition').value.trim(),
783
+ application: document.getElementById('edit-application').value.trim(),
784
+ method: document.getElementById('edit-method').value.trim(),
785
+ example: document.getElementById('edit-example').value.trim(),
786
+ synonyms: document.getElementById('edit-synonyms').value.trim()
787
+ };
788
+
789
+ // Validation
790
+ if (!updatedEntry.term) {
791
+ showNotification('Term is required', 'error');
792
+ return;
793
+ }
794
+
795
+ if (!updatedEntry.definition) {
796
+ showNotification('Definition is required', 'error');
797
+ return;
798
+ }
799
+
800
+ updateEntry(currentEditId, updatedEntry);
801
+ showNotification('Entry updated successfully!', 'success');
802
+
803
+ // Close modal
804
+ document.getElementById('edit-modal').checked = false;
805
+
806
+ // Refresh views if needed
807
+ if (!document.getElementById('search-content').classList.contains('hidden')) {
808
+ performSearch();
809
+ }
810
+
811
+ if (!document.getElementById('records-content').classList.contains('hidden')) {
812
+ displayAllRecords();
813
+ }
814
+ });
815
+
816
+ // Delete entry
817
+ let currentDeleteId = null;
818
+
819
+ function handleDeleteClick(e) {
820
+ currentDeleteId = e.target.closest('.delete-btn').dataset.id;
821
+
822
+ // Update modal content
823
+ const entries = getEntries();
824
+ const entry = entries.find(e => e.id == currentDeleteId);
825
+
826
+ document.getElementById('delete-modal-body').textContent =
827
+ `Are you sure you want to delete "${entry.term}"? This action cannot be undone.`;
828
+
829
+ // Show modal
830
+ document.getElementById('delete-modal').checked = true;
831
+ }
832
+
833
+ document.getElementById('confirm-delete').addEventListener('click', function() {
834
+ deleteEntry(currentDeleteId);
835
+ showNotification('Entry deleted successfully!', 'success');
836
+
837
+ // Close modal
838
+ document.getElementById('delete-modal').checked = false;
839
+
840
+ // Refresh views if needed
841
+ if (!document.getElementById('search-content').classList.contains('hidden')) {
842
+ performSearch();
843
+ }
844
+
845
+ if (!document.getElementById('records-content').classList.contains('hidden')) {
846
+ displayAllRecords();
847
+ }
848
+ });
849
+
850
+ // Import/Export functionality
851
+ document.getElementById('import-btn').addEventListener('click', function() {
852
+ const fileInput = document.getElementById('import-file');
853
+ const file = fileInput.files[0];
854
+
855
+ if (!file) {
856
+ showNotification('Please select a file to import', 'error');
857
+ return;
858
+ }
859
+
860
+ const reader = new FileReader();
861
+ reader.onload = function(e) {
862
+ try {
863
+ const data = new Uint8Array(e.target.result);
864
+ const workbook = XLSX.read(data, { type: 'array' });
865
+ const firstSheet = workbook.Sheets[workbook.SheetNames[0]];
866
+ const jsonData = XLSX.utils.sheet_to_json(firstSheet);
867
+
868
+ // Validate data structure
869
+ const requiredFields = ['Term', 'Definition'];
870
+ const missingFields = requiredFields.filter(field => !jsonData[0] || !jsonData[0].hasOwnProperty(field));
871
+
872
+ if (missingFields.length > 0) {
873
+ showNotification(`Required column(s) missing: ${missingFields.join(', ')}`, 'error');
874
+ return;
875
+ }
876
+
877
+ // Process data
878
+ const entries = getEntries();
879
+ let importedCount = 0;
880
+
881
+ jsonData.forEach(row => {
882
+ // Skip empty rows
883
+ if (!row.Term || !row.Definition) return;
884
+
885
+ const entry = {
886
+ term: row.Term.trim(),
887
+ category: row.Category || '',
888
+ definition: row.Definition.trim(),
889
+ application: row.Application || '',
890
+ method: row.Method || '',
891
+ example: row.Example || '',
892
+ synonyms: row.Synonyms || '',
893
+ id: Date.now() + Math.floor(Math.random() * 1000) // Generate unique ID
894
+ };
895
+
896
+ // Check if term already exists and update if needed
897
+ const existingIndex = entries.findIndex(e => e.term.toLowerCase() === entry.term.toLowerCase());
898
+ if (existingIndex > -1) {
899
+ entries[existingIndex] = { ...entries[existingIndex], ...entry };
900
+ } else {
901
+ entries.push(entry);
902
+ }
903
+
904
+ importedCount++;
905
+ });
906
+
907
+ saveEntries(entries);
908
+ showNotification(`Successfully imported ${importedCount} trading terms!`, 'success');
909
+
910
+ // Clear file input
911
+ fileInput.value = '';
912
+
913
+ // Refresh views
914
+ if (!document.getElementById('records-content').classList.contains('hidden')) {
915
+ displayAllRecords();
916
+ }
917
+ } catch (error) {
918
+ console.error(error);
919
+ showNotification('Error processing file. Please check the format and try again.', 'error');
920
+ }
921
+ };
922
+
923
+ reader.readAsArrayBuffer(file);
924
+ });
925
+
926
+ document.getElementById('export-btn').addEventListener('click', function() {
927
+ const entries = getEntries();
928
+
929
+ if (entries.length === 0) {
930
+ showNotification('No data to export', 'warning');
931
+ return;
932
+ }
933
+
934
+ // Transform data for export
935
+ const exportData = entries.map(entry => {
936
+ const categoryLabels = {
937
+ 'technical-analysis': 'Technical Analysis',
938
+ 'fundamental-analysis': 'Fundamental Analysis',
939
+ 'trading-strategy': 'Trading Strategy',
940
+ 'risk-management': 'Risk Management',
941
+ 'market-structure': 'Market Structure',
942
+ 'indicators': 'Indicators',
943
+ 'candlestick-patterns': 'Candlestick Patterns',
944
+ 'crypto-trading': 'Crypto Trading',
945
+ 'options-trading': 'Options Trading'
946
+ };
947
+
948
+ return {
949
+ 'Term': entry.term,
950
+ 'Category': categoryLabels[entry.category] || entry.category,
951
+ 'Definition': entry.definition,
952
+ 'Application': entry.application || '',
953
+ 'Method': entry.method || '',
954
+ 'Example': entry.example || '',
955
+ 'Synonyms': entry.synonyms || ''
956
+ };
957
+ });
958
+
959
+ // Create worksheet
960
+ const worksheet = XLSX.utils.json_to_sheet(exportData);
961
+
962
+ // Create workbook
963
+ const workbook = XLSX.utils.book_new();
964
+ XLSX.utils.book_append_sheet(workbook, worksheet, 'Trading Dictionary');
965
+
966
+ // Generate file
967
+ XLSX.writeFile(workbook, `trading_dictionary_export_${new Date().toISOString().split('T')[0]}.xlsx`);
968
+
969
+ showNotification('Data exported successfully!', 'success');
970
+ });
971
+
972
+ // Helper functions
973
+ function renderEntryCard(entry) {
974
+ const categoryLabels = {
975
+ 'technical-analysis': 'Technical Analysis',
976
+ 'fundamental-analysis': 'Fundamental Analysis',
977
+ 'trading-strategy': 'Trading Strategy',
978
+ 'risk-management': 'Risk Management',
979
+ 'market-structure': 'Market Structure',
980
+ 'indicators': 'Indicators',
981
+ 'candlestick-patterns': 'Candlestick Patterns',
982
+ 'crypto-trading': 'Crypto Trading',
983
+ 'options-trading': 'Options Trading'
984
+ };
985
+
986
+ const categoryLabel = categoryLabels[entry.category] || entry.category;
987
+
988
+ return `
989
+ <div class="card bg-gray-700 shadow-md border border-gray-600 mb-4 transition-all duration-200 hover:shadow-lg">
990
+ <div class="card-body p-6">
991
+ <div class="flex justify-between items-start">
992
+ <h3 class="card-title text-xl font-bold text-trading-green">
993
+ ${entry.term}
994
+ </h3>
995
+ <span class="badge bg-gray-600 text-trading-blue">${categoryLabel}</span>
996
+ </div>
997
+
998
+ <div class="mt-4">
999
+ <h4 class="font-semibold text-trading-green mb-2">Definition</h4>
1000
+ <p class="text-gray-200">${entry.definition}</p>
1001
+ </div>
1002
+
1003
+ ${entry.application ? `
1004
+ <div class="mt-4">
1005
+ <h4 class="font-semibold text-trading-blue mb-2">How to Use / Application</h4>
1006
+ <p class="text-gray-200">${entry.application}</p>
1007
+ </div>` : ''}
1008
+
1009
+ ${entry.synonyms ? `
1010
+ <div class="mt-4">
1011
+ <h4 class="font-semibold text-trading-blue mb-2">Related Terms</h4>
1012
+ <div class="flex flex-wrap gap-1 mt-1">
1013
+ ${entry.synonyms.split(',').map(synonym =>
1014
+ `<span class="badge bg-gray-600 text-gray-200">${synonym.trim()}</span>`
1015
+ ).join('')}
1016
+ </div>
1017
+ </div>` : ''}
1018
+
1019
+ <div class="card-actions justify-end mt-6 space-x-2">
1020
+ <button class="btn btn-outline btn-sm view-btn text-trading-blue border-trading-blue hover:bg-gray-600" data-id="${entry.id}">
1021
+ <i class="fas fa-eye mr-1"></i>View Details
1022
+ </button>
1023
+ <button class="btn btn-outline btn-sm edit-btn text-green-400 border-green-400 hover:bg-gray-600" data-id="${entry.id}">
1024
+ <i class="fas fa-edit mr-1"></i>Edit
1025
+ </button>
1026
+ <button class="btn btn-outline btn-error btn-sm delete-btn border-red-400 hover:bg-gray-600" data-id="${entry.id}">
1027
+ <i class="fas fa-trash mr-1"></i>Delete
1028
+ </button>
1029
+ </div>
1030
+ </div>
1031
+ </div>
1032
+ `;
1033
+ }
1034
+
1035
+ function truncateText(text, maxLength) {
1036
+ if (text.length <= maxLength) {
1037
+ return text;
1038
+ }
1039
+ return text.substring(0, maxLength) + '...';
1040
+ }
1041
+
1042
+ function showNotification(message, type = 'success') {
1043
+ const toast = document.getElementById('toast');
1044
+ const toastContent = document.getElementById('toast-content');
1045
+ const toastMessage = document.getElementById('toast-message');
1046
+
1047
+ // Set message and style
1048
+ toastMessage.textContent = message;
1049
+
1050
+ // Remove previous classes
1051
+ toastContent.className = 'alert rounded-lg shadow-lg';
1052
+
1053
+ // Add appropriate class based on type
1054
+ if (type === 'error') {
1055
+ toastContent.classList.add('bg-red-600', 'text-white');
1056
+ } else if (type === 'warning') {
1057
+ toastContent.classList.add('bg-yellow-600', 'text-white');
1058
+ } else {
1059
+ toastContent.classList.add('bg-trading-green', 'text-white');
1060
+ }
1061
+
1062
+ // Show toast
1063
+ toast.classList.remove('hidden');
1064
+
1065
+ // Hide after 3 seconds
1066
+ setTimeout(() => {
1067
+ toast.classList.add('hidden');
1068
+ }, 3000);
1069
+ }
1070
+
1071
+ // Initialize the app
1072
+ displayAllRecords();
1073
+ });
1074
+ </script>
1075
+ <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-qwensite.hf.space/logo.svg" alt="qwensite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-qwensite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >QwenSite</a> - 🧬 <a href="https://enzostvs-qwensite.hf.space?remix=alterzick/trading-dictionary" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
1076
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ ganti warna background agak tidak hitam putih sehingga mudah di baca