khronoz commited on
Commit
fb3baa1
·
unverified ·
1 Parent(s): 1d4f56e

Refactored Code (#12)

Browse files
.github/workflows/check-file-size.yml CHANGED
@@ -4,9 +4,9 @@ on:
4
  # On pull requests to the main branch
5
  pull_request:
6
  branches: [main]
7
- # On pushes to the main branch
8
- push:
9
- branches: [main]
10
  # to run this workflow manually from the Actions tab
11
  workflow_dispatch:
12
  # to run this workflow from another workflow
 
4
  # On pull requests to the main branch
5
  pull_request:
6
  branches: [main]
7
+ # # Or directly On pushes to the main branch
8
+ # push:
9
+ # branches: [main]
10
  # to run this workflow manually from the Actions tab
11
  workflow_dispatch:
12
  # to run this workflow from another workflow
.github/workflows/pipeline.yml CHANGED
@@ -8,8 +8,6 @@ on:
8
 
9
  # Test, Build and Deploy the app
10
  jobs:
11
- check-file-size:
12
- uses: ./.github/workflows/check-file-size.yml
13
  test-build-node-js-app:
14
  uses: ./.github/workflows/node-js-tests.yml
15
  test-build-python-package:
 
8
 
9
  # Test, Build and Deploy the app
10
  jobs:
 
 
11
  test-build-node-js-app:
12
  uses: ./.github/workflows/node-js-tests.yml
13
  test-build-python-package:
frontend/app/components/chat-section.tsx CHANGED
@@ -1,7 +1,7 @@
1
  "use client";
2
 
3
  import { useChat } from "ai/react";
4
- import { ChatInput, ChatMessages } from "./ui/chat";
5
 
6
  export default function ChatSection() {
7
  const {
 
1
  "use client";
2
 
3
  import { useChat } from "ai/react";
4
+ import { ChatInput, ChatMessages } from "@/app/components/ui/chat";
5
 
6
  export default function ChatSection() {
7
  const {
frontend/app/components/footer.tsx CHANGED
@@ -1,7 +1,7 @@
1
  "use client";
2
 
3
- import { FooterNavLink } from "./ui/navlink";
4
- import { IconGitHub } from "./ui/icons";
5
  import { Text, Cookie } from "lucide-react";
6
 
7
  export default function Footer() {
 
1
  "use client";
2
 
3
+ import { FooterNavLink } from "@/app/components/ui/navlink";
4
+ import { IconGitHub } from "@/app/components/ui/icons";
5
  import { Text, Cookie } from "lucide-react";
6
 
7
  export default function Footer() {
frontend/app/components/header.tsx CHANGED
@@ -7,8 +7,8 @@ import { useEffect, useState } from "react";
7
  import { useMedia } from 'react-use';
8
  import useSWR from 'swr';
9
  import logo from '@/public/smart-retrieval-logo.webp';
10
- import { HeaderNavLink } from './ui/navlink';
11
- import { MobileMenu } from './ui/mobilemenu';
12
 
13
  const MobileMenuItems = [
14
  {
@@ -125,7 +125,7 @@ export default function Header() {
125
  >
126
  {isMobileMenuOpen ? (
127
  <span role="img" aria-label="close icon">
128
- <X/>
129
  </span>
130
  ) : (
131
  <span role="img" aria-label="menu icon">
@@ -133,8 +133,6 @@ export default function Header() {
133
  </span>)}
134
  </button>
135
  </div>
136
- {/* Mobile menu component */}
137
- <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setMobileMenuOpen(false)} logoSrc={logo} items={MobileMenuItems} />
138
  <div className={`hidden items-center gap-4 lg:flex`}>
139
  <HeaderNavLink href="/">
140
  <div className="flex items-center transition duration-300 ease-in-out transform hover:scale-125">
@@ -201,6 +199,8 @@ export default function Header() {
201
  </button>
202
  </div>
203
  </div>
 
 
204
  </nav>
205
  </div>
206
  );
 
7
  import { useMedia } from 'react-use';
8
  import useSWR from 'swr';
9
  import logo from '@/public/smart-retrieval-logo.webp';
10
+ import { HeaderNavLink } from '@/app/components/ui/navlink';
11
+ import { MobileMenu } from '@/app/components/ui/mobilemenu';
12
 
13
  const MobileMenuItems = [
14
  {
 
125
  >
126
  {isMobileMenuOpen ? (
127
  <span role="img" aria-label="close icon">
128
+ <X />
129
  </span>
130
  ) : (
131
  <span role="img" aria-label="menu icon">
 
133
  </span>)}
134
  </button>
135
  </div>
 
 
136
  <div className={`hidden items-center gap-4 lg:flex`}>
137
  <HeaderNavLink href="/">
138
  <div className="flex items-center transition duration-300 ease-in-out transform hover:scale-125">
 
199
  </button>
200
  </div>
201
  </div>
202
+ {/* Mobile menu component */}
203
+ <MobileMenu isOpen={isMobileMenuOpen} onClose={() => setMobileMenuOpen(false)} logoSrc={logo} items={MobileMenuItems} />
204
  </nav>
205
  </div>
206
  );
frontend/app/components/query-section.tsx CHANGED
@@ -1,7 +1,7 @@
1
  "use client";
2
 
3
  import { useChat } from "ai/react";
4
- import { ChatInput, ChatMessages } from "./ui/chat";
5
 
6
  export default function QuerySection() {
7
  const {
 
1
  "use client";
2
 
3
  import { useChat } from "ai/react";
4
+ import { ChatInput, ChatMessages } from "@/app/components/ui/chat";
5
 
6
  export default function QuerySection() {
7
  const {
frontend/app/components/search-section.tsx CHANGED
@@ -1,7 +1,6 @@
1
  // SearchSection.tsx
2
  "use client";
3
 
4
- import { SearchResult } from "@/app/components/ui/search/search-types";
5
  import { useState, ChangeEvent, FormEvent } from "react";
6
  import useSearch from "@/app/components/ui/search/useSearch";
7
  import SearchResults from "@/app/components/ui/search/search-results";
 
1
  // SearchSection.tsx
2
  "use client";
3
 
 
4
  import { useState, ChangeEvent, FormEvent } from "react";
5
  import useSearch from "@/app/components/ui/search/useSearch";
6
  import SearchResults from "@/app/components/ui/search/search-results";
frontend/app/components/ui/button.tsx CHANGED
@@ -1,7 +1,7 @@
1
  import { Slot } from "@radix-ui/react-slot";
2
  import { cva, type VariantProps } from "class-variance-authority";
3
  import { forwardRef } from "react";
4
- import { cn } from "./lib/utils";
5
 
6
  const buttonVariants = cva(
7
  "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
 
1
  import { Slot } from "@radix-ui/react-slot";
2
  import { cva, type VariantProps } from "class-variance-authority";
3
  import { forwardRef } from "react";
4
+ import { cn } from "@/app/components/ui/lib/utils";
5
 
6
  const buttonVariants = cva(
7
  "inline-flex items-center justify-center whitespace-nowrap rounded-md text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50",
frontend/app/components/ui/input.tsx CHANGED
@@ -1,6 +1,6 @@
1
  import { forwardRef } from "react";
2
 
3
- import { cn } from "./lib/utils";
4
 
5
  export interface InputProps
6
  extends React.InputHTMLAttributes<HTMLInputElement> {}
 
1
  import { forwardRef } from "react";
2
 
3
+ import { cn } from "@/app/components/ui/lib/utils";
4
 
5
  export interface InputProps
6
  extends React.InputHTMLAttributes<HTMLInputElement> {}
frontend/app/components/ui/search/search-input.tsx CHANGED
@@ -1,8 +1,8 @@
1
  // SearchInput.tsx
2
 
3
  import { ChangeEvent, FormEvent } from "react";
4
- import { Button } from "../button";
5
- import { Input } from "../input";
6
  import { Search } from "lucide-react";
7
 
8
  interface SearchInputProps {
 
1
  // SearchInput.tsx
2
 
3
  import { ChangeEvent, FormEvent } from "react";
4
+ import { Button } from "@/app/components/ui/button";
5
+ import { Input } from "@/app/components/ui/input";
6
  import { Search } from "lucide-react";
7
 
8
  interface SearchInputProps {
frontend/app/components/ui/search/search-results.tsx CHANGED
@@ -1,5 +1,5 @@
1
- import { SearchResult } from "./search-types";
2
- import { IconSpinner } from "../icons";
3
  import { Fragment, useState } from "react";
4
  import { ArrowDownFromLine, ArrowUpFromLine, Copy } from "lucide-react";
5
  import { ToastContainer, toast } from 'react-toastify';
 
1
+ import { SearchResult } from "@/app/components/ui/search/search-types"
2
+ import { IconSpinner } from "@/app/components/ui/icons";
3
  import { Fragment, useState } from "react";
4
  import { ArrowDownFromLine, ArrowUpFromLine, Copy } from "lucide-react";
5
  import { ToastContainer, toast } from 'react-toastify';
frontend/app/components/ui/search/useSearch.tsx CHANGED
@@ -1,7 +1,7 @@
1
  "use client";
2
 
3
  import { useState, useEffect } from "react";
4
- import { SearchResult } from "./search-types";
5
 
6
  interface UseSearchResult {
7
  searchResults: SearchResult[];
 
1
  "use client";
2
 
3
  import { useState, useEffect } from "react";
4
+ import { SearchResult } from "@/app/components/ui/search/search-types";
5
 
6
  interface UseSearchResult {
7
  searchResults: SearchResult[];
frontend/app/layout.tsx CHANGED
@@ -1,12 +1,16 @@
1
  import type { Metadata } from "next";
2
  import { Inter } from "next/font/google";
3
- import "./globals.css";
4
- import { Providers } from './providers'
5
  import Header from "@/app/components/header";
6
  import Footer from "@/app/components/footer";
7
  import Main from "@/app/components/ui/main-container";
8
 
9
- const inter = Inter({ subsets: ["latin"] });
 
 
 
 
10
 
11
  export const metadata: Metadata = {
12
  title: "Smart Retrieval",
@@ -28,8 +32,8 @@ export default function RootLayout({
28
  children: React.ReactNode;
29
  }) {
30
  return (
31
- <html lang="en">
32
- <body className={inter.className}>
33
  <Providers>
34
  <Main>
35
  <Header />
 
1
  import type { Metadata } from "next";
2
  import { Inter } from "next/font/google";
3
+ import "@/app/globals.css";
4
+ import { Providers } from "@/app/providers";
5
  import Header from "@/app/components/header";
6
  import Footer from "@/app/components/footer";
7
  import Main from "@/app/components/ui/main-container";
8
 
9
+ const inter = Inter({
10
+ subsets: ['latin'],
11
+ display: 'swap',
12
+ variable: '--font-inter',
13
+ })
14
 
15
  export const metadata: Metadata = {
16
  title: "Smart Retrieval",
 
32
  children: React.ReactNode;
33
  }) {
34
  return (
35
+ <html lang="en" className={inter.variable}>
36
+ <body>
37
  <Providers>
38
  <Main>
39
  <Header />
frontend/app/page.tsx CHANGED
@@ -1,5 +1,5 @@
1
  import Home from '@/app/components/ui/home/client-component';
2
- import { Metadata } from 'next';
3
 
4
  export const metadata: Metadata = {
5
  // Google Search Console HTML Tag Verification
 
1
  import Home from '@/app/components/ui/home/client-component';
2
+ import type { Metadata } from "next";
3
 
4
  export const metadata: Metadata = {
5
  // Google Search Console HTML Tag Verification
frontend/middleware.ts CHANGED
@@ -6,5 +6,5 @@ export { default } from "next-auth/middleware"
6
 
7
  // Ensure auth is required for all except the following paths
8
  export const config = {
9
- matcher: ['/((?!api/auth|_next/static|_next/image|favicon.ico|about|sign-in|privacy-policy|terms-of-service|sitemap.xml|robots.txt).+)']
10
  };
 
6
 
7
  // Ensure auth is required for all except the following paths
8
  export const config = {
9
+ matcher: ['/((?!api/auth|_next/static|_next/image|favicon.ico|favicon-16x16.png|apple-touch-icon.png|about|sign-in|privacy-policy|terms-of-service|sitemap.xml|robots.txt).+)']
10
  };
frontend/public/robots.txt CHANGED
@@ -1,5 +1,3 @@
1
- //robots.txt
2
-
3
  # Block all crawlers for /accounts
4
  User-agent: *
5
  Disallow: /accounts
 
 
 
1
  # Block all crawlers for /accounts
2
  User-agent: *
3
  Disallow: /accounts
frontend/tailwind.config.ts CHANGED
@@ -1,5 +1,4 @@
1
  import type { Config } from "tailwindcss";
2
- import { fontFamily } from "tailwindcss/defaultTheme";
3
 
4
  const config: Config = {
5
  darkMode: ["class"],
@@ -59,7 +58,7 @@ const config: Config = {
59
  sm: "calc(var(--radius) - 4px)",
60
  },
61
  fontFamily: {
62
- sans: ["var(--font-sans)", ...fontFamily.sans],
63
  },
64
  keyframes: {
65
  "accordion-down": {
 
1
  import type { Config } from "tailwindcss";
 
2
 
3
  const config: Config = {
4
  darkMode: ["class"],
 
58
  sm: "calc(var(--radius) - 4px)",
59
  },
60
  fontFamily: {
61
+ sans: ["var(--font-inter)"],
62
  },
63
  keyframes: {
64
  "accordion-down": {