diff --git a/.eslintrc.js b/.eslintrc.js
index 8c1f1f56..e928b868 100644
--- a/.eslintrc.js
+++ b/.eslintrc.js
@@ -7,9 +7,4 @@ module.exports = {
parserOptions: {
project: true,
},
- // ignore some rules
- rules: {
- "@": "off",
- "import/no-unresolved": "off",
- },
};
diff --git a/apps/web/app/(dash)/(memories)/content.tsx b/apps/web/app/(dash)/(memories)/content.tsx
index 9f84a6b6..879c0502 100644
--- a/apps/web/app/(dash)/(memories)/content.tsx
+++ b/apps/web/app/(dash)/(memories)/content.tsx
@@ -284,7 +284,10 @@ function LinkComponent({
- {title}
+ {/* remove `<---chunkId: ${vector.id}\n${content}\n---->` pattern from title */}
+
+ {title.replace(/(<---chunkId: .*?\n.*?\n---->)/g, "")}
+
{url.replace("https://supermemory.ai", "").split("#")[0] ?? "/"}
@@ -294,7 +297,9 @@ function LinkComponent({
Note
- {title}
+
+ {title.replace(/(<---chunkId: .*?\n.*?\n---->)/g, "")}
+
{content.replace(title, "")}
diff --git a/apps/web/app/(dash)/menu.tsx b/apps/web/app/(dash)/menu.tsx
index d9ba6c71..c807c579 100644
--- a/apps/web/app/(dash)/menu.tsx
+++ b/apps/web/app/(dash)/menu.tsx
@@ -17,34 +17,15 @@ import {
} from "@repo/ui/shadcn/dialog";
import { Label } from "@repo/ui/shadcn/label";
import { Textarea } from "@repo/ui/shadcn/textarea";
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@repo/ui/shadcn/select";
import { toast } from "sonner";
import { getSpaces } from "../actions/fetchers";
-import { Space } from "../actions/types";
-import {
- Tooltip,
- TooltipContent,
- TooltipProvider,
- TooltipTrigger,
-} from "@repo/ui/shadcn/tooltip";
-import { InformationCircleIcon } from "@heroicons/react/24/outline";
import { HomeIcon } from "@heroicons/react/24/solid";
import { createMemory, createSpace } from "../actions/doers";
-import { Input } from "@repo/ui/shadcn/input";
import ComboboxWithCreate from "@repo/ui/shadcn/combobox";
import { StoredSpace } from "@/server/db/schema";
-import { revalidatePath } from "next/cache";
import useMeasure from "react-use-measure";
-import { motion } from "framer-motion";
function Menu() {
- const [ref, bounds] = useMeasure();
const [spaces, setSpaces] = useState([]);
useEffect(() => {
@@ -109,7 +90,7 @@ function Menu() {
[spaces],
);
- const handleSubmit = async (content?: string, space?: string) => {
+ const handleSubmit = async (content?: string, spaces?: number[]) => {
setDialogOpen(false);
toast.info("Creating memory...", {
@@ -122,12 +103,15 @@ function Menu() {
return;
}
+ console.log(spaces);
+
const cont = await createMemory({
content: content,
- spaces: space ? [space] : undefined,
+ spaces: spaces ?? undefined,
});
setContent("");
+ setSelectedSpaces([]);
if (cont.success) {
toast.success("Memory created", {
@@ -187,148 +171,138 @@ function Menu() {
-
-
-
+
+
+
+
{/* Mobile Menu */}
diff --git a/apps/web/app/actions/doers.ts b/apps/web/app/actions/doers.ts
index fcbab0f8..16dcf169 100644
--- a/apps/web/app/actions/doers.ts
+++ b/apps/web/app/actions/doers.ts
@@ -158,7 +158,7 @@ const getTweetData = async (tweetID: string) => {
export const createMemory = async (input: {
content: string;
- spaces?: string[];
+ spaces?: number[];
}): ServerActionReturnType => {
const data = await auth();
@@ -239,7 +239,7 @@ export const createMemory = async (input: {
title: metadata.title,
description: metadata.description,
url: metadata.baseUrl,
- spaces: storeToSpaces,
+ spaces: storeToSpaces.map((spaceId) => spaceId.toString()),
user: data.user.id,
type,
}),
@@ -302,7 +302,7 @@ export const createMemory = async (input: {
const insertResponse = await db
.insert(storedContent)
.values({
- content: response.chunkedInput,
+ content: pageContent,
title: metadata.title,
description: metadata.description,
url: saveToDbUrl,
@@ -355,13 +355,7 @@ export const createMemory = async (input: {
.select()
.from(space)
.where(
- and(
- inArray(
- space.id,
- storeToSpaces.map((s) => parseInt(s)),
- ),
- eq(space.user, data.user.id),
- ),
+ and(inArray(space.id, storeToSpaces), eq(space.user, data.user.id)),
)
.all();
@@ -371,7 +365,7 @@ export const createMemory = async (input: {
.insert(contentToSpace)
.values({ contentId: contentId, spaceId: s.id });
- db.update(space).set({ numItems: s.numItems + 1 });
+ await db.update(space).set({ numItems: s.numItems + 1 });
}),
);
}
diff --git a/apps/web/components/twitter/render-tweet.tsx b/apps/web/components/twitter/render-tweet.tsx
index 9d6d1a8a..889f1977 100644
--- a/apps/web/components/twitter/render-tweet.tsx
+++ b/apps/web/components/twitter/render-tweet.tsx
@@ -15,7 +15,7 @@ import s from "./tweet-header.module.css";
import { VerifiedBadge } from "./verified-badge";
type Props = {
- tweet: Tweet;
+ tweet: Tweet | { error: string };
components?: TwitterComponents;
};
@@ -101,6 +101,10 @@ const TweetHeader = ({
};
export const MyTweet = ({ tweet: t, components }: Props) => {
+ if ("error" in t) {
+ return {t.error}
;
+ }
+
const tweet = enrichTweet(t);
return (
diff --git a/package.json b/package.json
index 7a0fa0b8..38669d01 100644
--- a/package.json
+++ b/package.json
@@ -25,7 +25,7 @@
"eslint-plugin-next-on-pages": "^1.11.3",
"lint-staged": "^15.2.5",
"postcss": "^8.4.38",
- "prettier": "^3.2.5",
+ "prettier": "^3.3.3",
"readline-sync": "^1.4.10",
"tailwindcss": "^3.4.3",
"tailwindcss-animate": "^1.0.7",
@@ -79,6 +79,7 @@
"cheerio": "^1.0.0-rc.12",
"compromise": "^14.13.0",
"drizzle-orm": "0.30.0",
+ "eslint-config-turbo": "^2.0.6",
"framer-motion": "^11.2.6",
"geist": "^1.3.0",
"grammy": "^1.25.1",
diff --git a/packages/shared-types/utils.ts b/packages/shared-types/utils.ts
index c97d053c..0bd86564 100644
--- a/packages/shared-types/utils.ts
+++ b/packages/shared-types/utils.ts
@@ -12,15 +12,12 @@ export const tweetToMd = (tweet: Tweet) => {
export const getRawTweet = (tweet: string) => {
// Get the content inside the last tag, there can any number of tags in the tweet (or just one)
- const rawTag = /(.*)<\/raw>/gs; // Use 's' flag to match across multiple lines
+ const rawTag = /(.*)<\/raw>/g;
const match = rawTag.exec(tweet);
- if (match && match.length > 1) {
- // Remove the specified item pattern
- const cleanedContent = match[1]?.replace(
- /<---chunkId:.*?\n.*?\n---->/gs,
- "",
- );
- return cleanedContent;
+ if (match) {
+ return match[1];
}
- return tweet;
+ return `{
+ "error": "No tag found"
+ }`;
};
diff --git a/packages/ui/shadcn/combobox.tsx b/packages/ui/shadcn/combobox.tsx
index 9fdb4b67..eb7cab25 100644
--- a/packages/ui/shadcn/combobox.tsx
+++ b/packages/ui/shadcn/combobox.tsx
@@ -52,23 +52,6 @@ const ComboboxWithCreate: React.FC = ({
value={inputValue}
/>
-
-
-
{options.map((option, idx) => (
= ({
{option.label}
))}
+ {!options.map((opts) => opts.label).includes(inputValue) && (
+
+ )}