File size: 7,319 Bytes
4cf63e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
0aea3fd
 
 
 
 
4cf63e7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
{% extends "base.html" %}

{% block content %}
<div>
    <!-- Powered by -->
    <div class="text-xs text-gray-400 mb-4">
        Vector search powered by <a href="https://lancedb.github.io/lance/" class="underline hover:text-gray-600">Lance</a>
        &middot; Updated weekly via <a href="https://huggingface.co/docs/hub/en/spaces-run-with-hf-jobs" class="underline hover:text-gray-600">HF Jobs</a>
        &middot; <a href="https://huggingface.co/datasets/librarian-bots/arxiv-cs-papers-lance" class="underline hover:text-gray-600">Dataset</a>
    </div>

    <!-- Stats - minimal -->
    <div class="flex items-baseline gap-2 mb-6">
        <span class="text-3xl font-semibold text-gray-900">{{ "{:,}".format(new_dataset_count) }}</span>
        <span class="text-gray-500">papers with new datasets</span>
        <span class="text-gray-400 text-sm ml-auto">from {{ "{:,}".format(total_papers) }} total</span>
    </div>

    <!-- Filters - sticky on scroll -->
    <div class="sticky top-0 z-10 bg-white flex flex-wrap items-center gap-4 py-4 border-b border-gray-200 mb-6">
        <!-- Search -->
        <input type="search"
               name="search"
               id="search-input"
               placeholder="Search..."
               value="{{ search }}"
               class="flex-1 min-w-48 px-3 py-2 border-b border-gray-300 bg-transparent focus:border-gray-900 focus:outline-none"
               hx-get="/papers"
               hx-trigger="input changed delay:500ms, keyup[key=='Enter'], histogramChange"
               hx-target="#paper-list"
               hx-include="#filter-form, #category-select, #confidence-filter, #since-filter, #sort-select, #search-type-toggle"
               hx-indicator="#loading-indicator"
               hx-push-url="true">

        <!-- Search mode toggle -->
        <div id="search-type-toggle" class="flex items-center gap-2 text-xs text-gray-500">
            <label class="flex items-center gap-1 cursor-pointer">
                <input type="radio" name="search_type" value="keyword" {% if search_type == 'keyword' %}checked{% endif %}
                       class="h-3 w-3"
                       hx-get="/papers"
                       hx-trigger="change"
                       hx-target="#paper-list"
                       hx-include="#filter-form, #search-input, #category-select, #confidence-filter, #since-filter, #sort-select"
                       hx-indicator="#loading-indicator"
                       hx-push-url="true">
                <span>Keyword</span>
            </label>
            <label class="flex items-center gap-1 cursor-pointer">
                <input type="radio" name="search_type" value="semantic" {% if search_type == 'semantic' %}checked{% endif %}
                       class="h-3 w-3"
                       hx-get="/papers"
                       hx-trigger="change"
                       hx-target="#paper-list"
                       hx-include="#filter-form, #search-input, #category-select, #confidence-filter, #since-filter, #sort-select"
                       hx-indicator="#loading-indicator"
                       hx-push-url="true">
                <span>Semantic</span>
            </label>
        </div>

        <!-- Category filter -->
        <select name="category"
                id="category-select"
                class="px-3 py-2 border-b border-gray-300 bg-transparent focus:border-gray-900 focus:outline-none text-gray-700"
                hx-get="/papers"
                hx-trigger="change"
                hx-target="#paper-list"
                hx-include="#filter-form, #search-input, #confidence-filter, #since-filter, #sort-select, #search-type-toggle"
                hx-indicator="#loading-indicator"
                hx-push-url="true">
            <option value="">All categories</option>
            {% for cat in categories %}
            <option value="{{ cat }}" {% if category == cat %}selected{% endif %}>{{ cat }}</option>
            {% endfor %}
        </select>

        <!-- Confidence filter dropdown -->
        <select name="min_confidence"
                id="confidence-filter"
                class="px-2 py-1 text-xs border-b border-gray-300 bg-transparent focus:border-gray-900 focus:outline-none text-gray-500 ml-auto"
                hx-get="/papers"
                hx-trigger="change"
                hx-target="#paper-list"
                hx-include="#filter-form, #search-input, #category-select, #since-filter, #sort-select, #search-type-toggle"
                hx-indicator="#loading-indicator"
                hx-push-url="true">
            {% for opt in confidence_options %}
            <option value="{{ opt.value }}" {% if min_confidence == opt.value %}selected{% endif %}>
                {{ opt.label }}
            </option>
            {% endfor %}
        </select>

        <!-- Since filter dropdown -->
        <select name="since"
                id="since-filter"
                class="px-2 py-1 text-xs border-b border-gray-300 bg-transparent focus:border-gray-900 focus:outline-none text-gray-500"
                hx-get="/papers"
                hx-trigger="change"
                hx-target="#paper-list"
                hx-include="#filter-form, #search-input, #category-select, #confidence-filter, #sort-select, #search-type-toggle"
                hx-indicator="#loading-indicator"
                hx-push-url="true">
            <option value="" {% if not since %}selected{% endif %}>All time</option>
            <option value="1m" {% if since == '1m' %}selected{% endif %}>Past month</option>
            <option value="6m" {% if since == '6m' %}selected{% endif %}>Past 6 months</option>
            <option value="1y" {% if since == '1y' %}selected{% endif %}>Past year</option>
        </select>

        <!-- Sort dropdown -->
        <select name="sort"
                id="sort-select"
                class="px-2 py-1 text-xs border-b border-gray-300 bg-transparent focus:border-gray-900 focus:outline-none text-gray-500"
                hx-get="/papers"
                hx-trigger="change"
                hx-target="#paper-list"
                hx-include="#filter-form, #search-input, #category-select, #confidence-filter, #since-filter, #search-type-toggle"
                hx-indicator="#loading-indicator"
                hx-push-url="true">
            <option value="date" {% if sort == 'date' %}selected{% endif %}>Newest first</option>
            <option value="relevance" {% if sort == 'relevance' %}selected{% endif %}>Relevance</option>
        </select>

        <!-- Loading indicator - subtle -->
        <span id="loading-indicator" class="htmx-indicator text-sm text-gray-400">Loading...</span>

        <!-- Hidden form for hx-include -->
        <form id="filter-form" class="hidden"></form>
    </div>

    <!-- Paper list -->
    <div id="paper-list"
         hx-get="/papers?{% if search %}search={{ search|urlencode }}&{% endif %}search_type={{ search_type }}&{% if category %}category={{ category|urlencode }}&{% endif %}min_confidence={{ min_confidence }}&{% if since %}since={{ since }}&{% endif %}sort={{ sort }}"
         hx-trigger="load"
         hx-indicator="#loading-indicator">
        <div class="py-8 text-gray-400 text-sm">Loading papers...</div>
    </div>
</div>
{% endblock %}