mirror of
https://github.com/bogdancornescu/Faro.git
synced 2026-07-08 19:20:47 +02:00
Add URL content type support and enhance snippet functionality:
- Introduced 'url' as a new content type in the application. - Updated database queries to include copy count for snippets. - Enhanced UI components to display copy count and handle URL snippets.
This commit is contained in:
+11
-3
@@ -7,7 +7,7 @@
|
||||
import CenterPanel from '$lib/components/layout/CenterPanel.svelte';
|
||||
import RightPanel from '$lib/components/layout/RightPanel.svelte';
|
||||
import SettingsModal from '$lib/components/SettingsModal.svelte';
|
||||
import type { CreateSnippetInput, UpdateSnippetInput, TimePeriod } from '$lib/types';
|
||||
import type { CreateSnippetInput, UpdateSnippetInput, TimePeriod, ContentType } from '$lib/types';
|
||||
|
||||
let mode = $state<'idle' | 'creating' | 'editing'>('idle');
|
||||
let formDirty = $state(false);
|
||||
@@ -118,8 +118,9 @@
|
||||
|
||||
<div class="app-layout">
|
||||
<LeftPanel
|
||||
tags={store.tags}
|
||||
tags={store.visibleTags}
|
||||
activeFilter={store.tagFilter}
|
||||
contentTypeFilter={store.contentTypeFilter}
|
||||
timePeriodFilter={store.timePeriodFilter}
|
||||
onFilterChange={(tag) => {
|
||||
if (formDirty && !confirm('You have unsaved changes. Discard them?')) return;
|
||||
@@ -127,6 +128,12 @@
|
||||
store.select(null);
|
||||
mode = 'idle';
|
||||
}}
|
||||
onContentTypeChange={(ct: ContentType | null) => {
|
||||
if (formDirty && !confirm('You have unsaved changes. Discard them?')) return;
|
||||
store.setContentTypeFilter(ct);
|
||||
store.select(null);
|
||||
mode = 'idle';
|
||||
}}
|
||||
onTimePeriodChange={(period: TimePeriod | null) => {
|
||||
if (formDirty && !confirm('You have unsaved changes. Discard them?')) return;
|
||||
store.setTimePeriodFilter(period);
|
||||
@@ -142,6 +149,7 @@
|
||||
loading={store.loading}
|
||||
searchQuery={store.searchQuery}
|
||||
tagFilter={store.tagFilter}
|
||||
contentTypeFilter={store.contentTypeFilter}
|
||||
timePeriodFilter={store.timePeriodFilter}
|
||||
onSelect={handleSelectSnippet}
|
||||
onSearch={(q) => {
|
||||
@@ -170,7 +178,7 @@
|
||||
<style>
|
||||
.app-layout {
|
||||
display: grid;
|
||||
grid-template-columns: 220px 1fr 360px;
|
||||
grid-template-columns: 270px 1fr 360px;
|
||||
grid-template-rows: 100vh;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
|
||||
@@ -97,7 +97,7 @@
|
||||
<div class="field">
|
||||
<label for="type-buttons">Type</label>
|
||||
<div class="type-buttons" id="type-buttons" role="group">
|
||||
{#each (['code', 'cli', 'text'] as ContentType[]) as t (t)}
|
||||
{#each (['code', 'cli', 'text', 'url'] as ContentType[]) as t (t)}
|
||||
<button
|
||||
class="type-btn"
|
||||
class:active={contentType === t}
|
||||
|
||||
Reference in New Issue
Block a user