vtProjectSearchapi.tsx3 matches
1415// Handle typeahead API requests
16export function handleTypeahead(req: Request): Response {
17const url = new URL(req.url);
18const searchTerm = url.searchParams.get("q") || "";
4647// Handle user vals API requests
48export async function handleUserVals(req: Request): Response {
49const url = new URL(req.url);
50const username = url.searchParams.get("user") || "";
142143// Main request handler
144export async function handler(req: Request): Promise<Response> {
145const url = new URL(req.url);
146
vtProjectSearchcomponents.tsx14 matches
1718// Define the Activity Heatmap component
19export function ActivityHeatmap({ activityData }: { activityData: { date: string; count: number }[] }) {
20// Convert activity data to a map for easier lookup
21const activityMap = new Map(activityData.map(item => [item.date, item.count]));
157158// Helper to highlight the search terms in the code
159export function highlightText(text: string, searchTerm: string): JSX.Element {
160if (!searchTerm) return <>{text}</>;
161178179// CodeBlock component for displaying code with line numbers
180export function CodeBlock(
181{ matchedLines, searchTerm, totalMatches: _totalMatches }: {
182matchedLines: EnhancedSearchResult["matchedLines"];
204205// File search result component
206export function FileSearchResultComponent(
207{ result, searchTerm }: { result: EnhancedSearchResult; searchTerm: string },
208) {
282283// Val search result component
284export function ValSearchResultComponent(
285{ result, searchTerm }: { result: ValSearchResult; searchTerm: string },
286) {
356357// User search result component
358export function UserSearchResultComponent(
359{ result, searchTerm }: { result: UserSearchResult; searchTerm: string },
360) {
415416// Sub-section result for docs
417export function SubDocResultComponent(
418{ result, _searchTerm }: { result: SubDocResult; _searchTerm: string },
419) {
436437// Doc search result component
438export function DocSearchResultComponent(
439{ result, searchTerm }: { result: DocSearchResult; searchTerm: string },
440) {
491492// Result count tabs component
493export function ResultTypeTabs({
494totalFileResults,
495totalValResults,
539540// Pagination component
541export function Pagination({
542currentPage,
543totalPages,
644645// Sample results component for preview of other result types
646export function SampleResultsSection({
647title,
648linkText,
681682// Main search page component
683export function SearchPage({
684fileResults,
685valResults,
1244<a href="?q=database" className="example-link">database</a>
1245<a href="?q=image" className="example-link">image</a>
1246<a href="?q=function" className="example-link">function</a>
1247<a href="?q=discord" className="example-link">discord</a>
1248<a href="?q=openai" className="example-link">openai</a>
1399<a href="?q=database" className="example-link">database</a>
1400<a href="?q=image" className="example-link">image</a>
1401<a href="?q=function" className="example-link">function</a>
1402<a href="?q=discord" className="example-link">discord</a>
1403<a href="?q=openai" className="example-link">openai</a>
vtProjectSearchclient.tsx12 matches
1// Client-side script for typeahead and keyboard navigation
2export const clientScript = `
3document.addEventListener('DOMContentLoaded', function() {
4const searchInput = document.getElementById('search-input');
5const resultsContainer = document.getElementById('typeahead-results');
11let selectedIndex = -1;
1213// Function to fetch typeahead results
14async function fetchTypeahead(query) {
15if (query.length < 1) {
16hideResults();
61}
6263// Function to display results
64function displayResults(results, query) {
65// Clear previous results
66resultsContainer.innerHTML = '';
102}
103104// Function to hide results
105function hideResults() {
106resultsContainer.classList.remove('active');
107selectedIndex = -1;
109110// Input event to trigger typeahead
111searchInput.addEventListener('input', function() {
112const query = this.value.trim();
113135136// Handle keyboard navigation
137searchInput.addEventListener('keydown', function(e) {
138const items = resultsContainer.querySelectorAll('.typeahead-item');
139167168// Update selection highlight
169function updateSelection(items) {
170items.forEach((item, i) => {
171if (i === selectedIndex) {
178179// Close results when clicking outside
180document.addEventListener('click', function(e) {
181if (!searchInput.contains(e.target) && !resultsContainer.contains(e.target)) {
182hideResults();
185186// Handle mouse movement to keep the search term item highlighted
187resultsContainer.addEventListener('mouseover', function(e) {
188// Find the search term item (last child)
189const searchItem = resultsContainer.querySelector('.search-term');
1import { Evaluation } from "npm:@autoblocks/client/testing";
23export default async function httpHandler(request: Request): Promise<Response> {
4if (request.method !== "POST") {
5return Response.json({ message: "Invalid method." }, {
vtProjectSearchutils.tsx2 matches
1// Format date to relative time
2export function formatRelativeTime(dateString: string): string {
3const date = new Date(dateString);
4const now = new Date();
3738// Format date for tooltip (full date)
39export function formatFullDate(dateString: string): string {
40const date = new Date(dateString);
41return date.toLocaleDateString("en-US", {
vtProjectSearchdocsearch.ts2 matches
62* @param query Search query
63*/
64export async function searchDocsCount(
65query: string
66): Promise<number> {
85* @param fetchData Whether to fetch the full data for each result
86*/
87export async function searchDocs(
88query: string,
89page: number = 1,
vtProjectSearchdeno.lock4 matches
131"dependencies": [
132"es-errors",
133"function-bind"
134]
135},
216]
217},
218"function-bind@1.1.2": {
219"integrity": "sha512-7XHNxH7qX9xG5mIwxkhumTox/MIRNcOgDrxWsMt2pAr23WHp6MrRlN7FBSFpCpr+oVO0F744iUgR82nJMfG2SA=="
220},
226"es-errors",
227"es-object-atoms",
228"function-bind",
229"get-proto",
230"gopd",
256"integrity": "sha512-0hJU9SCPvmMzIBdZFqNPXWa6dqh7WdH0cII9y+CyS8rG3nL48Bclra9HmKhVVUHyPWNH5Y7xDwAB7bfgSjkUMQ==",
257"dependencies": [
258"function-bind"
259]
260},
8"https://img.clerk.com/eyJ0eXBlIjoiZGVmYXVsdCIsImlpZCI6Imluc18yTm10cGhQUklwU0tqZHNiOHNnNGd2ZjJURFUiLCJyaWQiOiJ1c2VyXzJnZ3hadk1yUE5VUk5KY01VZnZtSWV2b3pkaiJ9";
910export default async function(req: Request): Promise<Response> {
11const url = new URL(req.url);
12if (url.pathname === "/") return serveFile("./index.html", import.meta.url);
4const location = "prospect heights, brooklyn"; // <-- change to place, city, or zip code
56export async function aqi(interval: Interval) {
7const data = await easyAQI({ location });
8if (!interval.lastRunAt) {
48const cacheKey = (location: string) => "easyAQI_v3_" + encodeURIComponent(location);
4950export async function openAqNowcastAQI(location) {
51const sensorID = location.sensors.find(s => s.parameter.name === "pm25").id;
52const data = await fetchJSON(
64}
6566export async function easyAQI({ location }: {
67location: string;
68}) {