Skip to content

Commit

Permalink
Refactored Code (#12)
Browse files Browse the repository at this point in the history
* Refactored Code
  • Loading branch information
xKhronoz authored Feb 1, 2024
1 parent 1d4f56e commit fb3baa1
Show file tree
Hide file tree
Showing 17 changed files with 31 additions and 33 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/check-file-size.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ on:
# On pull requests to the main branch
pull_request:
branches: [main]
# On pushes to the main branch
push:
branches: [main]
# # Or directly On pushes to the main branch
# push:
# branches: [main]
# to run this workflow manually from the Actions tab
workflow_dispatch:
# to run this workflow from another workflow
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ on:

# Test, Build and Deploy the app
jobs:
check-file-size:
uses: ./.github/workflows/check-file-size.yml
test-build-node-js-app:
uses: ./.github/workflows/node-js-tests.yml
test-build-python-package:
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/chat-section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useChat } from "ai/react";
import { ChatInput, ChatMessages } from "./ui/chat";
import { ChatInput, ChatMessages } from "@/app/components/ui/chat";

export default function ChatSection() {
const {
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/footer.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { FooterNavLink } from "./ui/navlink";
import { IconGitHub } from "./ui/icons";
import { FooterNavLink } from "@/app/components/ui/navlink";
import { IconGitHub } from "@/app/components/ui/icons";
import { Text, Cookie } from "lucide-react";

export default function Footer() {
Expand Down
10 changes: 5 additions & 5 deletions frontend/app/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import { useEffect, useState } from "react";
import { useMedia } from 'react-use';
import useSWR from 'swr';
import logo from '@/public/smart-retrieval-logo.webp';
import { HeaderNavLink } from './ui/navlink';
import { MobileMenu } from './ui/mobilemenu';
import { HeaderNavLink } from '@/app/components/ui/navlink';
import { MobileMenu } from '@/app/components/ui/mobilemenu';

const MobileMenuItems = [
{
Expand Down Expand Up @@ -125,16 +125,14 @@ export default function Header() {
>
{isMobileMenuOpen ? (
<span role="img" aria-label="close icon">
<X/>
<X />
</span>
) : (
<span role="img" aria-label="menu icon">
<Menu />
</span>)}
</button>
</div>
{/* Mobile menu component */}
<MobileMenu isOpen={isMobileMenuOpen} onClose={() => setMobileMenuOpen(false)} logoSrc={logo} items={MobileMenuItems} />
<div className={`hidden items-center gap-4 lg:flex`}>
<HeaderNavLink href="/">
<div className="flex items-center transition duration-300 ease-in-out transform hover:scale-125">
Expand Down Expand Up @@ -201,6 +199,8 @@ export default function Header() {
</button>
</div>
</div>
{/* Mobile menu component */}
<MobileMenu isOpen={isMobileMenuOpen} onClose={() => setMobileMenuOpen(false)} logoSrc={logo} items={MobileMenuItems} />
</nav>
</div>
);
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/query-section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useChat } from "ai/react";
import { ChatInput, ChatMessages } from "./ui/chat";
import { ChatInput, ChatMessages } from "@/app/components/ui/chat";

export default function QuerySection() {
const {
Expand Down
1 change: 0 additions & 1 deletion frontend/app/components/search-section.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// SearchSection.tsx
"use client";

import { SearchResult } from "@/app/components/ui/search/search-types";
import { useState, ChangeEvent, FormEvent } from "react";
import useSearch from "@/app/components/ui/search/useSearch";
import SearchResults from "@/app/components/ui/search/search-results";
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/ui/button.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Slot } from "@radix-ui/react-slot";
import { cva, type VariantProps } from "class-variance-authority";
import { forwardRef } from "react";
import { cn } from "./lib/utils";
import { cn } from "@/app/components/ui/lib/utils";

const buttonVariants = cva(
"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",
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/ui/input.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { forwardRef } from "react";

import { cn } from "./lib/utils";
import { cn } from "@/app/components/ui/lib/utils";

export interface InputProps
extends React.InputHTMLAttributes<HTMLInputElement> {}
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/ui/search/search-input.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// SearchInput.tsx

import { ChangeEvent, FormEvent } from "react";
import { Button } from "../button";
import { Input } from "../input";
import { Button } from "@/app/components/ui/button";
import { Input } from "@/app/components/ui/input";
import { Search } from "lucide-react";

interface SearchInputProps {
Expand Down
4 changes: 2 additions & 2 deletions frontend/app/components/ui/search/search-results.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { SearchResult } from "./search-types";
import { IconSpinner } from "../icons";
import { SearchResult } from "@/app/components/ui/search/search-types"
import { IconSpinner } from "@/app/components/ui/icons";
import { Fragment, useState } from "react";
import { ArrowDownFromLine, ArrowUpFromLine, Copy } from "lucide-react";
import { ToastContainer, toast } from 'react-toastify';
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/components/ui/search/useSearch.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client";

import { useState, useEffect } from "react";
import { SearchResult } from "./search-types";
import { SearchResult } from "@/app/components/ui/search/search-types";

interface UseSearchResult {
searchResults: SearchResult[];
Expand Down
14 changes: 9 additions & 5 deletions frontend/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
import type { Metadata } from "next";
import { Inter } from "next/font/google";
import "./globals.css";
import { Providers } from './providers'
import "@/app/globals.css";
import { Providers } from "@/app/providers";
import Header from "@/app/components/header";
import Footer from "@/app/components/footer";
import Main from "@/app/components/ui/main-container";

const inter = Inter({ subsets: ["latin"] });
const inter = Inter({
subsets: ['latin'],
display: 'swap',
variable: '--font-inter',
})

export const metadata: Metadata = {
title: "Smart Retrieval",
Expand All @@ -28,8 +32,8 @@ export default function RootLayout({
children: React.ReactNode;
}) {
return (
<html lang="en">
<body className={inter.className}>
<html lang="en" className={inter.variable}>
<body>
<Providers>
<Main>
<Header />
Expand Down
2 changes: 1 addition & 1 deletion frontend/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Home from '@/app/components/ui/home/client-component';
import { Metadata } from 'next';
import type { Metadata } from "next";

export const metadata: Metadata = {
// Google Search Console HTML Tag Verification
Expand Down
2 changes: 1 addition & 1 deletion frontend/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ export { default } from "next-auth/middleware"

// Ensure auth is required for all except the following paths
export const config = {
matcher: ['/((?!api/auth|_next/static|_next/image|favicon.ico|about|sign-in|privacy-policy|terms-of-service|sitemap.xml|robots.txt).+)']
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).+)']
};
2 changes: 0 additions & 2 deletions frontend/public/robots.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
//robots.txt

# Block all crawlers for /accounts
User-agent: *
Disallow: /accounts
Expand Down
3 changes: 1 addition & 2 deletions frontend/tailwind.config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import type { Config } from "tailwindcss";
import { fontFamily } from "tailwindcss/defaultTheme";

const config: Config = {
darkMode: ["class"],
Expand Down Expand Up @@ -59,7 +58,7 @@ const config: Config = {
sm: "calc(var(--radius) - 4px)",
},
fontFamily: {
sans: ["var(--font-sans)", ...fontFamily.sans],
sans: ["var(--font-inter)"],
},
keyframes: {
"accordion-down": {
Expand Down

0 comments on commit fb3baa1

Please sign in to comment.