maxschulz-COL commited on
Commit
e7fe992
·
1 Parent(s): 1d14b94

Add new components

Browse files
Files changed (2) hide show
  1. assets/custom_css.css +10 -0
  2. components.py +58 -1
assets/custom_css.css CHANGED
@@ -306,3 +306,13 @@
306
  #open-settings-id:hover {
307
  cursor: pointer;
308
  }
 
 
 
 
 
 
 
 
 
 
 
306
  #open-settings-id:hover {
307
  cursor: pointer;
308
  }
309
+
310
+ .hover-effect {
311
+ transition: all 0.2s ease !important;
312
+ }
313
+
314
+ .hover-effect:hover {
315
+ background-color: rgba(255, 255, 255, 0.1) !important;
316
+ box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
317
+ transform: translateY(-2px);
318
+ }
components.py CHANGED
@@ -148,6 +148,33 @@ and security.
148
  )
149
 
150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
151
  class OffCanvas(vm.VizroBaseModel):
152
  """OffCanvas component for settings."""
153
 
@@ -202,14 +229,44 @@ class OffCanvas(vm.VizroBaseModel):
202
  className="mb-3",
203
  )
204
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
205
  offcanvas = dbc.Offcanvas(
206
  id=self.id,
207
  children=[
208
  html.Div(
209
  children=[
210
  input_groups,
 
211
  ]
212
- )
213
  ],
214
  title="Settings",
215
  is_open=True,
 
148
  )
149
 
150
 
151
+ def create_provider_item(name, url, note=None):
152
+ """Helper function to create a consistent ListGroupItem for each provider."""
153
+ return dbc.ListGroupItem(
154
+ [
155
+ html.Div(
156
+ [
157
+ html.Span(name, style={"color": "#ffffff"}),
158
+ (html.Small(note, style={"color": "rgba(255, 255, 255, 0.5)"}) if note else None),
159
+ html.Span("→", className="float-end", style={"color": "#ffffff"}),
160
+ ],
161
+ className="d-flex justify-content-between align-items-center",
162
+ )
163
+ ],
164
+ href=url,
165
+ target="_blank",
166
+ action=True,
167
+ style={
168
+ "background-color": "transparent",
169
+ "border": "1px solid rgba(255, 255, 255, 0.1)",
170
+ "margin-bottom": "8px",
171
+ "transition": "all 0.2s ease",
172
+ "cursor": "pointer",
173
+ },
174
+ class_name="list-group-item-action hover-effect",
175
+ )
176
+
177
+
178
  class OffCanvas(vm.VizroBaseModel):
179
  """OffCanvas component for settings."""
180
 
 
229
  className="mb-3",
230
  )
231
 
232
+ providers = [
233
+ {"name": "OpenAI", "url": "https://openai.com/index/openai-api/"},
234
+ {"name": "Anthropic", "url": "https://docs.anthropic.com/en/api/getting-started"},
235
+ {"name": "Mistral", "url": "https://docs.mistral.ai/getting-started/quickstart/"},
236
+ {"name": "xAI", "url": "https://x.ai/blog/api", "note": "(Free API credits available)"},
237
+ ]
238
+
239
+ api_instructions = html.Div(
240
+ [
241
+ html.Hr(
242
+ style={
243
+ "margin": "2rem 0",
244
+ "border-color": "rgba(255, 255, 255, 0.1)",
245
+ "border-style": "solid",
246
+ "border-width": "0 0 1px 0",
247
+ }
248
+ ),
249
+ html.Div("Get API Keys", className="mb-3", style={"color": "#ffffff"}),
250
+ dbc.ListGroup(
251
+ [
252
+ create_provider_item(name=provider["name"], url=provider["url"], note=provider.get("note"))
253
+ for provider in providers
254
+ ],
255
+ flush=True,
256
+ className="border-0",
257
+ ),
258
+ ],
259
+ )
260
+
261
  offcanvas = dbc.Offcanvas(
262
  id=self.id,
263
  children=[
264
  html.Div(
265
  children=[
266
  input_groups,
267
+ api_instructions,
268
  ]
269
+ ),
270
  ],
271
  title="Settings",
272
  is_open=True,