diff --git a/package.json b/package.json index 9765eea..d0a7b12 100644 --- a/package.json +++ b/package.json @@ -14,6 +14,7 @@ "url": "https://varunraj.in" }, "dependencies": { + "@google/generative-ai": "^0.21.0", "@radix-ui/react-accordion": "^1.2.1", "@radix-ui/react-avatar": "^1.1.0", "@radix-ui/react-checkbox": "^1.1.2", @@ -36,6 +37,7 @@ "@types/cookie": "^0.6.0", "@types/qs": "^6.9.15", "@types/react-calendar-heatmap": "^1.6.7", + "@vis.gl/react-google-maps": "^1.4.2", "axios": "^1.7.4", "chrono-node": "^1.4.9", "class-variance-authority": "^0.7.0", @@ -46,25 +48,28 @@ "date-fns": "^3.6.0", "drizzle-orm": "^0.33.0", "leaflet": "^1.9.4", - "leaflet-defaulticon-compatibility":"0.1.2", + "leaflet-defaulticon-compatibility": "0.1.2", "lucide-react": "^0.428.0", "next": "14.2.5", "next-themes": "^0.3.0", "pg": "^8.12.0", "qs": "^6.13.0", + "rc-mentions": "^2.18.0", "react": "^18", "react-calendar-heatmap": "^1.9.0", "react-day-picker": "9.0.8", "react-dom": "^18", "react-grid-gallery": "^1.0.1", "react-leaflet": "^4.2.1", + "react-mentions": "^4.4.10", "react-query": "^3.39.3", "recharts": "^2.12.7", "remotion": "4.0.232", "sass": "^1.77.8", "tailwind-merge": "^2.5.2", "tailwindcss-animate": "^1.0.7", - "yet-another-react-lightbox": "^3.21.4" + "yet-another-react-lightbox": "^3.21.4", + "zod": "^3.24.1" }, "devDependencies": { "@semantic-release/commit-analyzer": "^13.0.0", @@ -73,11 +78,12 @@ "@semantic-release/npm": "^12.0.1", "@semantic-release/release-notes-generator": "^14.0.1", "@types/jsonwebtoken": "^9.0.6", - "@types/leaflet":"^1.9.15", + "@types/leaflet": "^1.9.15", "@types/node": "^20", "@types/pg": "^8.11.6", "@types/react": "^18", "@types/react-dom": "^18", + "@types/react-mentions": "^4.4.1", "autoprefixer": "^10.4.20", "drizzle-kit": "^0.24.0", "eslint": "^8", diff --git a/postcss.config.js b/postcss.config.js deleted file mode 100644 index 33ad091..0000000 --- a/postcss.config.js +++ /dev/null @@ -1,6 +0,0 @@ -module.exports = { - plugins: { - tailwindcss: {}, - autoprefixer: {}, - }, -} diff --git a/postcss.config.mjs b/postcss.config.mjs index 1a69fd2..2ef30fc 100644 --- a/postcss.config.mjs +++ b/postcss.config.mjs @@ -2,6 +2,7 @@ const config = { plugins: { tailwindcss: {}, + autoprefixer: {}, }, }; diff --git a/src/components/find/FindInput.tsx b/src/components/find/FindInput.tsx new file mode 100644 index 0000000..094985e --- /dev/null +++ b/src/components/find/FindInput.tsx @@ -0,0 +1,52 @@ +import React, { useState } from 'react' +import inputStyle from './findInputStyle' +import { MentionsInput, Mention } from 'react-mentions' +import { searchPeople } from '@/handlers/api/people.handler'; +import mentionStyle from './findMentionStyle'; +import classNames from './FindInput.module.css'; + + +interface FindInputProps { + onSearch: (query: string) => void; +} + +export default function FindInput({ onSearch }: FindInputProps) { + + const [query, setQuery] = useState(""); + + const handleSearchPeople = async (e: any, callback: any) => { + if (!e.length) return []; + return searchPeople(e).then((people) => people.map((person: any) => ({ + id: person.id, + display: person.name, + }))).then((people) => callback(people)); + } + + return ( + { + if (e.key === 'Enter') { + onSearch(query); + } + }} + onChange={(e) => setQuery(e.target.value)}> + ( +
+ {highlightedDisplay.display} +
+ )} + /> +
+ ) +} diff --git a/src/components/find/findInputStyle.ts b/src/components/find/findInputStyle.ts new file mode 100644 index 0000000..4d44afe --- /dev/null +++ b/src/components/find/findInputStyle.ts @@ -0,0 +1,45 @@ +const findInputStyle = { + control: { + backgroundColor: 'hsl(var(--input))', + fontSize: 20, + fontWeight: 'normal', + outline: 'none', + borderRadius: '15px', + + }, + + '&singleLine': { + // display: 'inline-block', + width: '100%', + + highlighter: { + padding: '10px 15px', + border: 'none', + outline: 'none', + }, + input: { + padding: '10px 15px', + border: 'none', + outline: 'none', + }, + }, + + suggestions: { + + list: { + backgroundColor: 'hsl(var(--background))', + fontSize: 14, + border: '1px solid hsl(var(--border))', + overflow: 'hidden', + }, + item: { + padding: '5px 15px', + border: 'none', + '&focused': { + backgroundColor: 'hsl(var(--chart-2))', + }, + }, + }, +} + +export default findInputStyle; \ No newline at end of file diff --git a/src/components/find/findMentionStyle.ts b/src/components/find/findMentionStyle.ts new file mode 100644 index 0000000..721bc59 --- /dev/null +++ b/src/components/find/findMentionStyle.ts @@ -0,0 +1,4 @@ +export default { + backgroundColor: 'hsla(var(--chart-2) / 0.3)', + position: 'relative', +} diff --git a/src/components/layouts/PageLayout.tsx b/src/components/layouts/PageLayout.tsx index fb22e9c..16a3e52 100644 --- a/src/components/layouts/PageLayout.tsx +++ b/src/components/layouts/PageLayout.tsx @@ -23,11 +23,11 @@ export default function PageLayout({ children, className, title }: IProps) { : children; return ( -
+
{header}
{pageTitle} - Immich Power Tools )} -
+