Skip to content

Commit

Permalink
Merge pull request #31 from Blue-Net-Reflections-LLC/bugfix/stabiliza…
Browse files Browse the repository at this point in the history
…tion-branch-v0.1.0

Multiple prelaunch v0.1.0 Bug fixes
  • Loading branch information
hreid3 authored Jan 31, 2025
2 parents 5fa0989 + a668682 commit 4393b00
Show file tree
Hide file tree
Showing 10 changed files with 59 additions and 34 deletions.
7 changes: 4 additions & 3 deletions app/about/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ export default function AboutPage() {
<div className="mb-12">
<h2 className="text-3xl font-bold mb-6 text-zinc-900 dark:text-white">Our Vision</h2>
<p className="text-lg leading-relaxed text-zinc-700 dark:text-zinc-300">
VoterAI represents a groundbreaking collaboration between VoterAI and Bluenetreflection,
LegiEquity represents a groundbreaking collaboration between VoterAI and Bluenetreflection,
dedicated to revolutionizing how we understand and interact with legislative processes.
Through advanced AI analysis, we&apos;re making complex legislative information accessible and
meaningful to everyone.

</p>
</div>

Expand Down Expand Up @@ -96,8 +97,8 @@ export default function AboutPage() {
</div>

<div className="bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-950/30 dark:to-purple-950/30 p-8 rounded-lg">
<h2 className="text-3xl font-bold mb-6">Upcoming Blog</h2>
<p className="text-lg leading-relaxed">
<h2 className="text-3xl font-bold mb-6 text-zinc-900 dark:text-white">Upcoming Blog</h2>
<p className="text-lg leading-relaxed text-zinc-700 dark:text-zinc-300">
We&apos;re evolving our platform to include in-depth analysis of bills that have severe impacts across the nation.
Our upcoming blog will feature:
</p>
Expand Down
9 changes: 9 additions & 0 deletions app/api/search/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,18 @@ export async function POST(request: Request) {

// Remove stopwords and get meaningful tokens
const meaningfulWords = removeStopwords(keyword.toLowerCase().split(' '))

if (keyword.length > 0 && meaningfulWords.length === 0) {
//
return NextResponse.json({
results: [],
search_type: 'no_results'
})
}

// Common entity data selection
const entityDataCTE = `
entity_data AS (
SELECT
e.entity_type,
Expand Down
10 changes: 5 additions & 5 deletions app/blog/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export default function BlogPage() {
<div className="grid md:grid-cols-2 gap-8 mb-16">
<div className="bg-zinc-50 dark:bg-zinc-800/50 p-8 rounded-xl">
<Scale className="w-8 h-8 mb-4 text-purple-500" />
<h3 className="text-xl font-semibold mb-3">Impact Analysis</h3>
<h3 className="text-xl font-semibold mb-3 text-zinc-900 dark:text-white">Impact Analysis</h3>
<p className="text-zinc-600 dark:text-zinc-400">
Deep dives into legislation that significantly affects communities across the nation,
backed by data-driven insights and expert analysis.
Expand All @@ -72,7 +72,7 @@ export default function BlogPage() {

<div className="bg-zinc-50 dark:bg-zinc-800/50 p-8 rounded-xl">
<Users className="w-8 h-8 mb-4 text-blue-500" />
<h3 className="text-xl font-semibold mb-3">Community Voices</h3>
<h3 className="text-xl font-semibold mb-3 text-zinc-900 dark:text-white">Community Voices</h3>
<p className="text-zinc-600 dark:text-zinc-400">
Real stories from communities impacted by legislation, bringing human perspective
to policy discussions and fostering meaningful dialogue.
Expand All @@ -81,7 +81,7 @@ export default function BlogPage() {

<div className="bg-zinc-50 dark:bg-zinc-800/50 p-8 rounded-xl">
<Brain className="w-8 h-8 mb-4 text-indigo-500" />
<h3 className="text-xl font-semibold mb-3">AI-Powered Insights</h3>
<h3 className="text-xl font-semibold mb-3 text-zinc-900 dark:text-white">AI-Powered Insights</h3>
<p className="text-zinc-600 dark:text-zinc-400">
Leveraging advanced AI to uncover hidden patterns and potential implications
in legislative text, making complex bills more accessible.
Expand All @@ -90,7 +90,7 @@ export default function BlogPage() {

<div className="bg-zinc-50 dark:bg-zinc-800/50 p-8 rounded-xl">
<Newspaper className="w-8 h-8 mb-4 text-violet-500" />
<h3 className="text-xl font-semibold mb-3">Legislative Trends</h3>
<h3 className="text-xl font-semibold mb-3 text-zinc-900 dark:text-white">Legislative Trends</h3>
<p className="text-zinc-600 dark:text-zinc-400">
Tracking and analyzing emerging patterns in legislation across states,
providing early insights into potential nationwide impacts.
Expand All @@ -102,7 +102,7 @@ export default function BlogPage() {
<section className="bg-gradient-to-r from-blue-50 to-purple-50 dark:from-blue-950/30 dark:to-purple-950/30 p-8 rounded-xl">
<div className="flex items-center justify-between">
<div>
<h3 className="text-2xl font-bold mb-2">Stay Updated</h3>
<h3 className="text-2xl font-bold mb-2 text-zinc-900 dark:text-white">Stay Updated</h3>
<p className="text-zinc-600 dark:text-zinc-400">
Be the first to know when we launch and receive our latest insights.
</p>
Expand Down
11 changes: 9 additions & 2 deletions app/components/FilterDrawer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from "@/components/ui/sheet";
import { Button } from "@/app/components/ui/button";
import { useAnalytics } from '@/app/hooks/useAnalytics';
import { GTagData } from '@/app/utils/analytics';

const RACE_CODES = {
AI: 'American Indian/Alaska Native',
Expand All @@ -29,7 +30,7 @@ interface FilterOptions {
categories: string[];
}

interface FilterEventData {
interface FilterEventData extends GTagData {
event_category: string;
event_label: string;
filter_categories?: string[];
Expand All @@ -39,7 +40,7 @@ interface FilterEventData {
filter_committee?: string | null;
}

export default function FilterDrawer() {
function FilterDrawerContent() {
const router = useRouter();
const searchParams = useSearchParams();
const pathname = usePathname();
Expand Down Expand Up @@ -278,4 +279,10 @@ export default function FilterDrawer() {
</SheetContent>
</Sheet>
);
}

export default function FilterDrawer() {
return (
<FilterDrawerContent />
);
}
8 changes: 4 additions & 4 deletions app/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'
import { useState } from 'react'

const NavLinks = ({ onClick }: { onClick?: () => void }) => (
<ul className="flex flex-col sm:flex-row space-y-4 sm:space-y-0 sm:space-x-4">
<ul className="flex flex-col lg:flex-row space-y-4 lg:space-y-0 lg:space-x-4">
<li>
<Link
href="/"
Expand Down Expand Up @@ -60,7 +60,7 @@ export default function Header() {
</Link>

{/* Desktop Navigation */}
<nav className="hidden sm:flex items-center space-x-4">
<nav className="hidden lg:flex items-center space-x-4">
<NavLinks />
<div className="flex items-center space-x-2">
<SearchDialog />
Expand All @@ -69,15 +69,15 @@ export default function Header() {
</nav>

{/* Mobile Navigation */}
<div className="flex sm:hidden items-center space-x-2">
<div className="flex lg:hidden items-center space-x-2">
<SearchDialog />
<Sheet open={open} onOpenChange={setOpen}>
<SheetTrigger asChild>
<button className="p-2 hover:bg-zinc-100 rounded-full dark:hover:bg-zinc-800">
<Menu className="h-5 w-5 text-zinc-600 dark:text-zinc-400" />
</button>
</SheetTrigger>
<SheetContent side="right" className="w-[300px] sm:w-[400px] bg-white dark:bg-zinc-950">
<SheetContent side="right" className="w-[300px] lg:w-[400px] bg-white dark:bg-zinc-950">
<div className="absolute left-4 top-3">
<ThemeToggle showTooltip />
</div>
Expand Down
14 changes: 11 additions & 3 deletions app/components/filters/BillFiltersWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,21 @@ export function BillFiltersWrapper({ filters, stateCode }: BillFiltersWrapperPro
<Tooltip>
<DialogTrigger asChild>
<TooltipTrigger asChild>
<Button variant="outline" className="text-gray-900 dark:text-zinc-100">
<FilterIcon className="h-4 w-4" />
<Button
variant="outline"
className="bg-purple-600 dark:bg-purple-700 text-white border-purple-400 dark:border-transparent
transition-all duration-200 hover:scale-105
hover:bg-purple-700 dark:hover:bg-purple-800
hover:border-purple-500 dark:hover:border-transparent
text-base font-semibold px-4 py-2"
>
<FilterIcon className="h-5 w-5 mr-1" />
Explore
</Button>
</TooltipTrigger>
</DialogTrigger>
<TooltipContent className="bg-zinc-900 text-zinc-100 border border-zinc-700">
<p>Filter bills</p>
<p>Explore bill selection</p>
</TooltipContent>
</Tooltip>
<DialogContent className={cn(
Expand Down
4 changes: 2 additions & 2 deletions app/components/layout/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function Footer() {
<div className="grid grid-cols-1 md:grid-cols-3 gap-8">
{/* Company Info */}
<div className="space-y-4">
<h3 className="text-lg font-semibold text-zinc-900 dark:text-white">VoterAI</h3>
<h3 className="text-lg font-semibold text-zinc-900 dark:text-white">LegiEquity</h3>
<p className="text-sm text-zinc-500 dark:text-zinc-400">
A collaboration between VoterAI and Bluenetreflection
</p>
Expand Down Expand Up @@ -89,7 +89,7 @@ export function Footer() {
{/* Copyright */}
<div className="mt-8 pt-6 border-t border-zinc-200 dark:border-zinc-800">
<div className="text-sm text-center text-zinc-500 dark:text-zinc-400">
© 2025 VoterAI. All rights reserved.
© 2025 BLUE NET REFLECTIONS, LLC. All rights reserved.
</div>
</div>
</div>
Expand Down
10 changes: 5 additions & 5 deletions app/hooks/useAnalytics.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
'use client'

import { useEffect, useCallback } from 'react'
import { usePathname, useSearchParams } from 'next/navigation'
import { usePathname } from 'next/navigation'
import { safeGtag, initializeGtag } from '@/app/utils/analytics'

interface GTagData {
Expand Down Expand Up @@ -30,7 +30,6 @@ type TrackingAttributes = {

export const useAnalytics = () => {
const pathname = usePathname()
const searchParams = useSearchParams()

// Initialize GA
useEffect(() => {
Expand All @@ -42,19 +41,20 @@ export const useAnalytics = () => {
if (pathname) {
safeGtag('event', 'page_view', {
page_path: pathname,
page_search: searchParams?.toString(),
page_search: window.location.search,
page_title: document.title
})
}
}, [pathname, searchParams])
}, [pathname])

// Core tracking function
const trackEvent = useCallback((action: string, data?: GTagData) => {
try {
safeGtag('event', action, {
...data,
page_path: pathname,
page_title: document.title
page_title: document.title,
page_search: window.location.search
})
} catch (error) {
console.error('Analytics Error:', error)
Expand Down
10 changes: 4 additions & 6 deletions app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import '@/app/globals.css'
import { Inter } from 'next/font/google'
import Header from '@/app/components/Header'
import { systemThemeScript } from './utils/theme-script'
import ClientLayout from './components/ClientLayout'
import { GoogleAnalytics } from '@next/third-parties/google'
import { AnalyticsProvider } from './providers/AnalyticsProvider'

Expand All @@ -12,6 +11,7 @@ const inter = Inter({ subsets: ['latin'] })
export const metadata: Metadata = {
title: 'LegiEquity Monitor',
description: 'AI-powered legislative analysis for racial equity impact assessment',
metadataBase: new URL(process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:3000'),
}

export default function RootLayout({
Expand All @@ -25,13 +25,11 @@ export default function RootLayout({
<script dangerouslySetInnerHTML={{ __html: systemThemeScript() }} />
</head>
<body className={`${inter.className} antialiased bg-white dark:bg-zinc-900`}>
<Header />
<Header />
<main className="container mx-auto px-4 pt-8 pb-2">
<AnalyticsProvider>
<ClientLayout>
<AnalyticsProvider>
{children}
</ClientLayout>
</AnalyticsProvider>
</AnalyticsProvider>
</main>
<GoogleAnalytics gaId={process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID!} />
</body>
Expand Down
10 changes: 6 additions & 4 deletions app/utils/analytics.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
'use client'

interface GTagData {
export interface GTagData {
[key: string]: string | number | string[] | null | undefined;
}

type GTagArgs = [string, string, GTagData?];

declare global {
interface Window {
gtag: (
type: string,
action: string,
data?: GTagData
) => void;
dataLayer: IArguments[];
dataLayer?: GTagArgs[];
}
}

Expand All @@ -21,8 +23,8 @@ export const GA_MEASUREMENT_ID = process.env.NEXT_PUBLIC_GA_MEASUREMENT_ID
export const initializeGtag = () => {
if (typeof window !== 'undefined') {
window.dataLayer = window.dataLayer || []
function gtag(...args: [string, string, GTagData?]) {
window.dataLayer.push(args)
function gtag(...args: GTagArgs) {
window.dataLayer?.push(args)
}
window.gtag = gtag
window.gtag('js', new Date().toISOString())
Expand Down

0 comments on commit 4393b00

Please sign in to comment.