Skip to content
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions infrastructure/control-panel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"@eslint/js": "^9.18.0",
"@storybook/addon-svelte-csf": "^5.0.7",
"@storybook/sveltekit": "^9.0.17",
"@sveltejs/adapter-static": "^3.0.8",
"@sveltejs/adapter-node": "^5.3.3",
"@sveltejs/kit": "^2.22.0",
"@sveltejs/vite-plugin-svelte": "^6.0.0",
"@tailwindcss/vite": "^4.0.0",
Expand Down Expand Up @@ -54,4 +54,4 @@
"lucide-svelte": "^0.539.0",
"tailwind-merge": "^3.0.2"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { Low } from 'lowdb'
import { JSONFile } from 'lowdb/node'
import type { EVault } from '../../routes/api/evaults/+server';

// Define the cache data structure
Expand All @@ -20,7 +18,7 @@ const defaultData: CacheData = {
};

class CacheService {
private db: Low<CacheData> | null = null;
private db: any | null = null;
private isInitialized = false;

constructor() {
Expand All @@ -34,6 +32,10 @@ class CacheService {
if (this.isInitialized) return;

try {
// Dynamically import lowdb only on server
const { Low } = await import('lowdb');
const { JSONFile } = await import('lowdb/node');

// Initialize LowDB with JSON file adapter
const adapter = new JSONFile<CacheData>(CACHE_FILE);
this.db = new Low(adapter, defaultData);
Expand Down
2 changes: 1 addition & 1 deletion infrastructure/control-panel/svelte.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import adapter from '@sveltejs/adapter-static';
import adapter from '@sveltejs/adapter-node';
import { vitePreprocess } from '@sveltejs/vite-plugin-svelte';

/** @type {import('@sveltejs/kit').Config} */
Expand Down
10 changes: 9 additions & 1 deletion infrastructure/control-panel/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,13 @@ import tailwindcss from '@tailwindcss/vite';
import { defineConfig } from 'vite';

export default defineConfig({
plugins: [tailwindcss(), sveltekit()]
plugins: [tailwindcss(), sveltekit()],
optimizeDeps: {
exclude: ['lowdb', 'steno']
},
build: {
rollupOptions: {
external: ['lowdb', 'lowdb/node', 'steno']
}
}
});
2 changes: 2 additions & 0 deletions mappings/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
!.gitignore
./*
8 changes: 4 additions & 4 deletions evoting.compose.yml → metastate.compose.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
services:
db:
image: postgres:16
container_name: dev-evoting-db
container_name: dev-metastate-db
environment:
POSTGRES_USER: evoting
POSTGRES_PASSWORD: evoting
POSTGRES_DB: evoting
POSTGRES_USER: metastate
POSTGRES_PASSWORD: metastate
POSTGRES_DB: metastate
volumes:
- ./db/data:/var/lib/postgresql/data
ports:
Expand Down
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,16 @@
},
"pnpm": {
"onlyBuiltDependencies": [
"@firebase/util",
"@tailwindcss/oxide",
"bufferutil",
"core-js",
"@biomejs/biome",
"@parcel/watcher",
"cpu-features",
"es5-ext",
"esbuild",
"msw",
"protobufjs",
"sharp",
"sqlite3",
"ssh2",
"svelte-preprocess",
"unrs-resolver"
"svelte-preprocess"
]
}
}
10 changes: 5 additions & 5 deletions platforms/blabsy/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"date-fns": "^4.1.0",
"firebase": "^9.9.4",
"firebase-admin": "^13.4.0",
"framer-motion": "^7.2.1",
"motion": "^12.0.0",
"next": "^12.3.0",
"react": "18.2.0",
"react-dom": "18.2.0",
Expand All @@ -37,8 +37,8 @@
"@testing-library/react": "^13.3.0",
"@testing-library/user-event": "^13.5.0",
"@types/node": "18.6.4",
"@types/react": "18.0.16",
"@types/react-dom": "18.0.6",
"@types/react": "18.2.79",
"@types/react-dom": "18.2.25",
Comment on lines +40 to +41
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

🧩 Analysis chain

Potential Next.js 12 + TypeScript 5 incompatibility.

Next 12.3 historically targeted TS 4.x; TS 5.x may cause typecheck/build issues. If build fails, pin TS to 4.9.x for blabsy or upgrade Next.

Also applies to: 59-59


🌐 Web query:

Does Next.js 12.3 officially support TypeScript 5.x?

💡 Result:

No. Next.js 12.3 (released Sep 8, 2022) predates TypeScript 5.0 (released Mar 16, 2023) and Next.js’ docs for the v12 era reference TypeScript v4.x (minimum recommended v4.5.2), so Next.js 12.3 does not officially target/support TypeScript 5.x. [1][2][3]

Sources:

  • Next.js 12.3 release notes (Sep 8, 2022). [1]
  • Next.js TypeScript docs (mentions minimum/recommended TS v4.5.2). [2]
  • TypeScript 5.0 announcement (Mar 16, 2023). [3]

🏁 Script executed:

#!/usr/bin/env bash
rg -nC2 '"typescript"' platforms/blabsy/package.json

Length of output: 132


Pin TypeScript to 4.9.x or upgrade Next.js
platforms/blabsy/package.json:59 uses "typescript": "5.0.4", but Next.js 12.3 only supports TS 4.x. Build may break—pin TS to ^4.9.x or upgrade Next.js to v13+.

🤖 Prompt for AI Agents
In platforms/blabsy/package.json around lines 40–41 (and specifically the
typescript entry at ~line 59), the repo currently uses TypeScript 5.0.4 which is
incompatible with Next.js 12.3; either pin TypeScript to a 4.9.x range or
upgrade Next.js to v13+. To fix, change the "typescript" entry to a 4.9.x
version (e.g., "^4.9.5") in package.json, run your package manager
(npm/yarn/pnpm install) to update lockfiles, and verify the project builds;
alternatively, upgrade Next.js to v13+ if you prefer to keep TS 5.x, update any
breaking changes, reinstall, and run the build/tests.

"@typescript-eslint/eslint-plugin": "^5.32.0",
"@typescript-eslint/parser": "^5.32.0",
"autoprefixer": "^10.4.8",
Expand All @@ -56,9 +56,9 @@
"prettier-plugin-tailwindcss": "^0.1.13",
"sass": "^1.54.4",
"tailwindcss": "^3.2.4",
"typescript": "4.7.4"
"typescript": "5.0.4"
},
"lint-staged": {
"**/*": "prettier --write --ignore-unknown"
}
}
}
14 changes: 8 additions & 6 deletions platforms/blabsy/src/components/aside/aside-trends.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import Link from 'next/link';
import React from 'react';
import cn from 'clsx';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import { formatNumber } from '@lib/date';
import { preventBubbling } from '@lib/utils';
import { useTrends } from '@lib/api/trends';
Expand All @@ -9,9 +10,8 @@ import { HeroIcon } from '@components/ui/hero-icon';
import { Button } from '@components/ui/button';
import { ToolTip } from '@components/ui/tooltip';
import { Loading } from '@components/ui/loading';
import type { MotionProps } from 'framer-motion';

export const variants: MotionProps = {
export const variants = {
initial: { opacity: 0 },
animate: { opacity: 1 },
transition: { duration: 0.8 }
Expand All @@ -21,7 +21,7 @@ type AsideTrendsProps = {
inTrendsPage?: boolean;
};

export function AsideTrends({ inTrendsPage }: AsideTrendsProps): JSX.Element {
export function AsideTrends({ inTrendsPage }: AsideTrendsProps) {
const { data, loading } = useTrends(1, inTrendsPage ? 100 : 10, {
refreshInterval: 30000
});
Expand All @@ -32,18 +32,20 @@ export function AsideTrends({ inTrendsPage }: AsideTrendsProps): JSX.Element {
<section
className={cn(
!inTrendsPage &&
'hover-animation rounded-2xl bg-main-sidebar-background'
'hover-animation rounded-2xl bg-main-sidebar-background'
)}
>
{loading ? (
<Loading />
) : trends ? (
<motion.div
initial={{ opacity: 0 }}
animate={{ opacity: 1 }}
transition={{ duration: 0.8 }}
className={cn(
'inner:px-4 inner:py-3',
inTrendsPage && 'mt-0.5'
)}
{...variants}
>
{!inTrendsPage && (
<h2 className='text-xl font-extrabold'>
Expand Down
2 changes: 1 addition & 1 deletion platforms/blabsy/src/components/aside/suggestions.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Link from 'next/link';
import { motion } from 'framer-motion';
import { motion } from 'motion/react';
import {
doc,
limit,
Expand Down
55 changes: 26 additions & 29 deletions platforms/blabsy/src/components/chat/chat-window.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,13 @@ function MessageItem({
// Check if this is a system message
const isSystemMessage = !message.senderId || message.text.startsWith('$$system-message$$');
// Remove the prefix for display
const displayText = isSystemMessage && message.text.startsWith('$$system-message$$')
? message.text.replace('$$system-message$$', '').trim()
const displayText = isSystemMessage && message.text.startsWith('$$system-message$$')
? message.text.replace('$$system-message$$', '').trim()
: message.text;



if (isSystemMessage) {
if (isSystemMessage) {
return (
<div className="flex w-full justify-center my-4">
<div className="max-w-[80%] text-center">
Expand All @@ -63,14 +63,12 @@ function MessageItem({

return (
<div
className={`flex w-full ${
isOwnMessage ? 'justify-end' : 'justify-start'
}`}
className={`flex w-full ${isOwnMessage ? 'justify-end' : 'justify-start'
}`}
>
<div
className={`flex max-w-[70%] ${
isOwnMessage ? 'flex-col items-end' : 'flex-col items-start'
} gap-1`}
className={`flex max-w-[70%] ${isOwnMessage ? 'flex-col items-end' : 'flex-col items-start'
} gap-1`}
>
{/* User Avatar and Name - Above the message */}
{!isOwnMessage && showUserInfo && (
Expand Down Expand Up @@ -100,18 +98,16 @@ function MessageItem({

{/* Message Bubble */}
<div
className={`rounded-2xl px-4 py-2 ${
isOwnMessage
? 'bg-[#333399] text-white'
: 'bg-[#6600ff] text-white'
} ${!isOwnMessage ? 'ml-8' : ''}`}
className={`rounded-2xl px-4 py-2 ${isOwnMessage
? 'bg-[#333399] text-white'
: 'bg-[#6600ff] text-white'
} ${!isOwnMessage ? 'ml-8' : ''}`}
>
<div className='break-words whitespace-pre-wrap' dangerouslySetInnerHTML={{ __html: displayText.replace(/<a href="([^"]+)">([^<]+)<\/a>/g, '<a href="$1" class="text-blue-600 hover:text-blue-800 underline">$2</a>') }} />
{showTime && message.createdAt?.toDate && (
<p
className={`mt-1 text-xs ${
isOwnMessage ? 'text-white/70' : 'text-white/70'
}`}
className={`mt-1 text-xs ${isOwnMessage ? 'text-white/70' : 'text-white/70'
}`}
>
{formatDistanceToNow(message.createdAt.toDate(), {
addSuffix: true
Expand Down Expand Up @@ -233,7 +229,7 @@ export function ChatWindow(): JSX.Element {
try {
await sendNewMessage(messageText);
setMessageText('');
} catch (error) {}
} catch (error) { }
};

return (
Expand Down Expand Up @@ -273,13 +269,13 @@ export function ChatWindow(): JSX.Element {
<p className='font-medium'>
{getChatType(currentChat) === 'direct'
? otherUser?.name ||
otherUser?.username ||
otherParticipant
otherUser?.username ||
otherParticipant
: currentChat.name}
</p>
<p className='text-sm text-gray-500 dark:text-gray-400'>
{currentChat.type === 'direct'
? otherUser?.username
? otherUser?.username
? `@${otherUser.username}`
: 'Direct Message'
: `${currentChat.participants.length} participants`}
Expand Down Expand Up @@ -330,7 +326,7 @@ export function ChatWindow(): JSX.Element {
const showTime =
!nextMessage ||
nextMessage.senderId !==
message.senderId;
message.senderId;

// Show user info if:
// 1. It's a group chat AND
Expand All @@ -341,22 +337,23 @@ export function ChatWindow(): JSX.Element {
!isOwnMessage &&
(!prevMessage ||
prevMessage.senderId !==
message.senderId ||
message.senderId ||
(prevMessage.createdAt
?.toDate &&
message.createdAt?.toDate &&
Math.abs(
prevMessage.createdAt
.toDate()
.getTime() -
message.createdAt
.toDate()
.getTime()
message.createdAt
.toDate()
.getTime()
) >
5 * 60 * 1000));
5 * 60 * 1000));

const userData =
participantsData[message.senderId];
const userData = message.senderId
? participantsData[message.senderId]
: null;

return (
<MessageItem
Expand Down
21 changes: 10 additions & 11 deletions platforms/blabsy/src/components/input/image-preview.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useEffect, useRef, useState, useMemo } from 'react';
import { AnimatePresence, motion } from 'framer-motion';
import React, { useEffect, useRef, useState, useMemo } from 'react';
import { AnimatePresence, motion } from 'motion/react';
import cn from 'clsx';
import { useModal } from '@lib/hooks/useModal';
import { preventBubbling } from '@lib/utils';
Expand All @@ -10,7 +10,6 @@ import { NextImage } from '@components/ui/next-image';
import { Button } from '@components/ui/button';
import { HeroIcon } from '@components/ui/hero-icon';
import { ToolTip } from '@components/ui/tooltip';
import type { MotionProps } from 'framer-motion';
import type { ImagesPreview, ImageData } from '@lib/types/file';

type ImagePreviewProps = {
Expand All @@ -21,15 +20,15 @@ type ImagePreviewProps = {
removeImage?: (targetId: string) => () => void;
};

const variants: MotionProps = {
const variants = {
initial: { opacity: 0, scale: 0.5 },
animate: {
opacity: 1,
scale: 1,
transition: { duration: 0.3 }
},
exit: { opacity: 0, scale: 0.5 },
transition: { type: 'spring', duration: 0.5 }
transition: { type: 'spring' as const, duration: 0.5 }
};

type PostImageBorderRadius = Record<number, string[]>;
Expand Down Expand Up @@ -87,8 +86,8 @@ export function ImagePreview({
? actualPreviewCount - 1
: selectedIndex - 1
: selectedIndex === actualPreviewCount - 1
? 0
: selectedIndex + 1;
? 0
: selectedIndex + 1;

setSelectedIndex(nextIndex);
};
Expand Down Expand Up @@ -168,8 +167,8 @@ export function ImagePreview({
hover:brightness-75 hover:duration-200`,
isTweet
? postImageBorderRadius[
actualPreviewCount
]?.[index] || 'rounded-2xl'
actualPreviewCount
]?.[index] || 'rounded-2xl'
: 'rounded-2xl'
)}
src={src}
Expand All @@ -184,8 +183,8 @@ export function ImagePreview({
imgClassName={cn(
isTweet
? postImageBorderRadius[
actualPreviewCount
]?.[index] || 'rounded-2xl'
actualPreviewCount
]?.[index] || 'rounded-2xl'
: 'rounded-2xl'
)}
previewCount={actualPreviewCount}
Expand Down
Loading