Skip to content

Commit 511b9f9

Browse files
Copilotalegauss
andcommitted
Add /sn search template application with React + shadcn/ui
Co-authored-by: alegauss <331174+alegauss@users.noreply.github.com>
1 parent cde90f6 commit 511b9f9

24 files changed

+826
-1
lines changed

turing-shadcn/package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"type": "module",
66
"scripts": {
77
"dev": "vite",
8-
"compile": "npm install && tsc -b && vite build",
8+
"dev:search": "vite --config vite.config.search.ts --port 5174",
9+
"compile": "npm install && tsc -b && vite build && vite build --config vite.config.search.ts",
10+
"compile:console": "npm install && tsc -b && vite build",
11+
"compile:search": "npm install && tsc -b && vite build --config vite.config.search.ts",
912
"lint": "eslint .",
1013
"preview": "vite preview"
1114
},

turing-shadcn/search.html

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<!doctype html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
7+
<title>Turing Search</title>
8+
</head>
9+
<body>
10+
<div id="root"></div>
11+
<script type="module" src="/src/search/main.tsx"></script>
12+
</body>
13+
</html>
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { Route, Routes } from "react-router-dom"
2+
import SearchPage from "./pages/search.page"
3+
import { ThemeProvider } from "../components/theme-provider"
4+
import { Toaster } from "../components/ui/sonner"
5+
6+
function SearchApp() {
7+
return (
8+
<ThemeProvider defaultTheme="light" storageKey="turing-sn-theme">
9+
<Toaster />
10+
<Routes>
11+
<Route path="/" element={<SearchPage />} />
12+
<Route path="/:siteName" element={<SearchPage />} />
13+
</Routes>
14+
</ThemeProvider>
15+
)
16+
}
17+
18+
export default SearchApp

turing-shadcn/src/search/main.tsx

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import React from 'react'
2+
import { createRoot } from 'react-dom/client'
3+
import { BrowserRouter } from 'react-router-dom'
4+
import SearchApp from './SearchApp.tsx'
5+
import '../index.css'
6+
import axios from 'axios'
7+
8+
axios.defaults.baseURL = `${import.meta.env.VITE_API_URL}`;
9+
10+
// Use basename only in production
11+
const basename = import.meta.env.MODE === 'production' ? '/sn/templates' : '/';
12+
13+
createRoot(document.getElementById('root')!).render(
14+
<React.StrictMode>
15+
<BrowserRouter basename={basename}>
16+
<SearchApp />
17+
</BrowserRouter>
18+
</React.StrictMode>
19+
)
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface TurSNChat {
2+
text: string;
3+
enabled: boolean;
4+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
2+
export interface TurSNSearchDefaultFields {
3+
date: string;
4+
description: string;
5+
image: string;
6+
text: string;
7+
title: string;
8+
url: string;
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
export interface TurSNSearchDocumentField {
3+
[key: string]: any
4+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
export interface TurSNSearchDocumentMetadata {
2+
href: string;
3+
text: string;
4+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import type { TurSNSearchDocumentField } from "./sn-search-document-field.model";
2+
import type { TurSNSearchDocumentMetadata } from "./sn-search-document-metadata.model";
3+
4+
export interface TurSNSearchDocument {
5+
elevate: boolean;
6+
fields: TurSNSearchDocumentField;
7+
metadata: TurSNSearchDocumentMetadata[];
8+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
export interface TurSNSearchFacetItem {
2+
count: number;
3+
label: string;
4+
link: string;
5+
selected: number;
6+
}

0 commit comments

Comments
 (0)