fix: transcriptions history remounting of search box

This commit is contained in:
haritabh-z01 2025-09-11 22:41:28 +05:30
parent ec3ce44c40
commit 93496a2bde
7 changed files with 24 additions and 39 deletions

View file

@ -1,4 +1,4 @@
import { eq, desc, asc, and, like, count, gte, lte } from "drizzle-orm";
import { eq, desc, asc, and, ilike, count, gte, lte } from "drizzle-orm";
import { db } from ".";
import {
transcriptions,
@ -55,7 +55,7 @@ export async function getTranscriptions(
return await db
.select()
.from(transcriptions)
.where(like(transcriptions.text, `%${search}%`))
.where(ilike(transcriptions.text, `%${search}%`))
.orderBy(orderFn(sortColumn))
.limit(limit)
.offset(offset);
@ -113,7 +113,7 @@ export async function getTranscriptionsCount(search?: string) {
const result = await db
.select({ count: count() })
.from(transcriptions)
.where(like(transcriptions.text, `%${search}%`));
.where(ilike(transcriptions.text, `%${search}%`));
return result[0]?.count || 0;
} else {
const result = await db.select({ count: count() }).from(transcriptions);
@ -152,7 +152,7 @@ export async function searchTranscriptions(searchTerm: string, limit = 20) {
return await db
.select()
.from(transcriptions)
.where(like(transcriptions.text, `%${searchTerm}%`))
.where(ilike(transcriptions.text, `%${searchTerm}%`))
.orderBy(desc(transcriptions.timestamp))
.limit(limit);
}

View file

@ -420,14 +420,14 @@ export default function Note({
</PopoverContent>
</Popover> */}
<Tooltip>
{/* <Tooltip>
<TooltipTrigger asChild>
<Button variant="ghost" size="sm" disabled>
<Mic className="h-4 w-4" />
</Button>
</TooltipTrigger>
<TooltipContent>Transcription coming soon</TooltipContent>
</Tooltip>
</Tooltip> */}
{/* More actions dropdown */}
<DropdownMenu>

View file

@ -323,7 +323,6 @@ export default function HistorySettingsPage() {
});
const transcriptions = transcriptionsQuery.data || [];
const loading = transcriptionsQuery.isLoading;
function handleCopy(text: string) {
navigator.clipboard.writeText(text);
@ -351,30 +350,6 @@ export default function HistorySettingsPage() {
const groupedHistory = groupHistoryByDate(transcriptions);
// Loading state
if (loading) {
return (
<div className="container mx-auto p-6 max-w-5xl">
<div className="mb-8">
<h1 className="text-xl font-bold">History</h1>
<p className="text-muted-foreground mt-1 text-sm">
Your recent transcription history
</p>
</div>
<Card>
<CardContent className="py-12">
<div className="flex flex-col items-center space-y-2 text-center">
<div className="h-8 w-8 animate-spin rounded-full border-4 border-gray-300 border-t-blue-600"></div>
<p className="text-sm text-muted-foreground">
Loading transcription history...
</p>
</div>
</CardContent>
</Card>
</div>
);
}
return (
<div className="container mx-auto p-6 max-w-5xl">
{/* Header Section */}

View file

@ -65,9 +65,11 @@ export class TelemetryService {
}
try {
// Check if telemetry is enabled via environment variable
const apiKey = process.env.POSTHOG_API_KEY;
const telemetryEnabled = process.env.TELEMETRY_ENABLED !== "false";
// Check runtime env first, then fall back to bundled values
const apiKey = process.env.POSTHOG_API_KEY || __BUNDLED_POSTHOG_API_KEY;
const telemetryEnabled = process.env.TELEMETRY_ENABLED
? process.env.TELEMETRY_ENABLED !== "false"
: __BUNDLED_TELEMETRY_ENABLED;
if (!apiKey || !telemetryEnabled) {
logger.main.info("Telemetry disabled or no API key provided");
@ -84,7 +86,7 @@ export class TelemetryService {
logger.main.info("System information collected for telemetry");
// Initialize PostHog
const host = process.env.POSTHOG_HOST || "https://app.posthog.com";
const host = process.env.POSTHOG_HOST || __BUNDLED_POSTHOG_HOST;
this.posthog = new PostHog(apiKey, {
host,
flushAt: 1,

View file

@ -0,0 +1,3 @@
declare const __BUNDLED_POSTHOG_API_KEY: string;
declare const __BUNDLED_POSTHOG_HOST: string;
declare const __BUNDLED_TELEMETRY_ENABLED: boolean;

View file

@ -4,9 +4,13 @@ import { resolve } from "path";
// https://vitejs.dev/config
export default defineConfig({
define: {
'process.env.POSTHOG_API_KEY': JSON.stringify(process.env.POSTHOG_API_KEY || ''),
'process.env.POSTHOG_HOST': JSON.stringify(process.env.POSTHOG_HOST || 'https://app.posthog.com'),
'process.env.TELEMETRY_ENABLED': JSON.stringify(process.env.TELEMETRY_ENABLED || 'false'),
__BUNDLED_POSTHOG_API_KEY: JSON.stringify(
process.env.POSTHOG_API_KEY || "",
),
__BUNDLED_POSTHOG_HOST: JSON.stringify(process.env.POSTHOG_HOST || ""),
__BUNDLED_TELEMETRY_ENABLED: JSON.stringify(
process.env.TELEMETRY_ENABLED !== "false",
),
},
build: {
rollupOptions: {

View file

@ -2,7 +2,8 @@
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net9.0</TargetFramework>
<TargetFramework>net6.0</TargetFramework>
<RollForward>Major</RollForward>
<Nullable>enable</Nullable>
<RuntimeIdentifier>win-x64</RuntimeIdentifier>
<PublishSingleFile>true</PublishSingleFile>