mirror of
https://github.com/khoaliber/khoj.git
synced 2026-03-05 05:39:11 +00:00
Format next.js web app with prettier
This commit is contained in:
@@ -1,34 +1,25 @@
|
||||
'use client'
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@/components/ui/card"
|
||||
"use client";
|
||||
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
|
||||
|
||||
import styles from "./suggestions.module.css";
|
||||
import { getIconFromIconName } from "@/app/common/iconUtils";
|
||||
import { converColorToBgGradient } from "@/app/common/colorUtils";
|
||||
|
||||
|
||||
function convertSuggestionTitleToIconClass(title: string, color: string) {
|
||||
if (title.includes('automation')) return getIconFromIconName('Robot', color, 'w-8', 'h-8');
|
||||
if (title.includes('online')) return getIconFromIconName('Globe', color, 'w-8', 'h-8');
|
||||
if (title.includes('paint')) return getIconFromIconName('Palette', color, 'w-8', 'h-8');
|
||||
if (title.includes('pop')) return getIconFromIconName('Confetti', color, 'w-8', 'h-8');
|
||||
if (title.includes('travel')) return getIconFromIconName('Jeep', color, 'w-8', 'h-8');
|
||||
if (title.includes('learn')) return getIconFromIconName('Book', color, 'w-8', 'h-8');
|
||||
if (title.includes('health')) return getIconFromIconName('Asclepius', color, 'w-8', 'h-8');
|
||||
if (title.includes('fun')) return getIconFromIconName('Island', color, 'w-8', 'h-8');
|
||||
if (title.includes('home')) return getIconFromIconName('House', color, 'w-8', 'h-8');
|
||||
if (title.includes('language')) return getIconFromIconName('Translate', color, 'w-8', 'h-8');
|
||||
if (title.includes('code')) return getIconFromIconName('Code', color, 'w-8', 'h-8');
|
||||
|
||||
else return getIconFromIconName('Lightbulb', color, 'w-8', 'h-8');
|
||||
if (title.includes("automation")) return getIconFromIconName("Robot", color, "w-8", "h-8");
|
||||
if (title.includes("online")) return getIconFromIconName("Globe", color, "w-8", "h-8");
|
||||
if (title.includes("paint")) return getIconFromIconName("Palette", color, "w-8", "h-8");
|
||||
if (title.includes("pop")) return getIconFromIconName("Confetti", color, "w-8", "h-8");
|
||||
if (title.includes("travel")) return getIconFromIconName("Jeep", color, "w-8", "h-8");
|
||||
if (title.includes("learn")) return getIconFromIconName("Book", color, "w-8", "h-8");
|
||||
if (title.includes("health")) return getIconFromIconName("Asclepius", color, "w-8", "h-8");
|
||||
if (title.includes("fun")) return getIconFromIconName("Island", color, "w-8", "h-8");
|
||||
if (title.includes("home")) return getIconFromIconName("House", color, "w-8", "h-8");
|
||||
if (title.includes("language")) return getIconFromIconName("Translate", color, "w-8", "h-8");
|
||||
if (title.includes("code")) return getIconFromIconName("Code", color, "w-8", "h-8");
|
||||
else return getIconFromIconName("Lightbulb", color, "w-8", "h-8");
|
||||
}
|
||||
|
||||
|
||||
interface SuggestionCardProps {
|
||||
title: string;
|
||||
body: string;
|
||||
@@ -46,12 +37,17 @@ export default function SuggestionCard(data: SuggestionCardProps) {
|
||||
<Card className={cardClassName}>
|
||||
<CardHeader className="m-0 p-2 pb-1 relative">
|
||||
<div className="flex flex-row md:flex-col">
|
||||
{convertSuggestionTitleToIconClass(data.title.toLowerCase(), data.color.toLowerCase())}
|
||||
{convertSuggestionTitleToIconClass(
|
||||
data.title.toLowerCase(),
|
||||
data.color.toLowerCase(),
|
||||
)}
|
||||
<CardTitle className={titleClassName}>{data.title}</CardTitle>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="m-0 p-2 pr-4 pt-1">
|
||||
<CardDescription className={`${descriptionClassName} sm:line-clamp-2 md:line-clamp-4`}>
|
||||
<CardDescription
|
||||
className={`${descriptionClassName} sm:line-clamp-2 md:line-clamp-4`}
|
||||
>
|
||||
{data.body}
|
||||
</CardDescription>
|
||||
</CardContent>
|
||||
@@ -62,5 +58,7 @@ export default function SuggestionCard(data: SuggestionCardProps) {
|
||||
<a href={data.link} className="no-underline">
|
||||
{cardContent}
|
||||
</a>
|
||||
) : cardContent;
|
||||
) : (
|
||||
cardContent
|
||||
);
|
||||
}
|
||||
|
||||
@@ -149,7 +149,8 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Learning",
|
||||
color: "yellow",
|
||||
description: "Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",
|
||||
description:
|
||||
"Summarize the biography of this figure: https://en.wikipedia.org/wiki/Jean_Baptiste_Point_du_Sable",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
@@ -179,7 +180,8 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Paint",
|
||||
color: "green",
|
||||
description: "Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",
|
||||
description:
|
||||
"Paint a colorful scene of a traditional Day of the Dead celebration in Mexico.",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
@@ -233,7 +235,8 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Paint",
|
||||
color: "green",
|
||||
description: "Create a digital painting in the style of traditional Chinese ink wash landscape.",
|
||||
description:
|
||||
"Create a digital painting in the style of traditional Chinese ink wash landscape.",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
@@ -341,7 +344,8 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Provide a coding challenge to reverse a string without using built-in functions.",
|
||||
description:
|
||||
"Provide a coding challenge to reverse a string without using built-in functions.",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
@@ -353,7 +357,8 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",
|
||||
description:
|
||||
"Create a coding exercise to implement a basic sorting algorithm (e.g., bubble sort).",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
@@ -365,31 +370,36 @@ export const suggestionsData: Suggestion[] = [
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Provide a coding challenge to find the longest palindromic substring in a given string.",
|
||||
description:
|
||||
"Provide a coding challenge to find the longest palindromic substring in a given string.",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Explain the concept of asynchronous programming with a JavaScript Promise example.",
|
||||
description:
|
||||
"Explain the concept of asynchronous programming with a JavaScript Promise example.",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",
|
||||
description:
|
||||
"Create a coding exercise to implement a basic data structure (e.g., linked list or stack).",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Explain the time and space complexity of common algorithms (e.g., binary search).",
|
||||
description:
|
||||
"Explain the time and space complexity of common algorithms (e.g., binary search).",
|
||||
link: "",
|
||||
},
|
||||
{
|
||||
type: "Code",
|
||||
color: "purple",
|
||||
description: "Provide a coding challenge to implement a simple REST API using Node.js and Express.",
|
||||
description:
|
||||
"Provide a coding challenge to implement a simple REST API using Node.js and Express.",
|
||||
link: "",
|
||||
},
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user