Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
13 changes: 1 addition & 12 deletions api/apps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@ import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
import { apps, featuredApps, bumpRules } from '../src/db/schema';
import { eq, desc, and, gte, lte } from 'drizzle-orm';
import { normalizeOpalLogo } from '../src/lib/branding';

export const config = {
runtime: 'edge',
};

const OPAL_CANONICAL_LOGO = '/icons/opal2.png';

function normalizeOpalLogo<T extends { slug: string | null; logoUrl: string | null }>(app: T): T {
if (app.slug === 'opal') {
return {
...app,
logoUrl: OPAL_CANONICAL_LOGO,
};
}
return app;
}

export default async function handler(_request: Request) {
try {
const sqlClient = neon(process.env.DATABASE_URL!);
Expand Down
3 changes: 1 addition & 2 deletions api/profile/[slug].ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
import { users, userProfileApps, apps, appSubmissions } from '../../src/db/schema';
import { eq, and } from 'drizzle-orm';
import { OPAL_CANONICAL_LOGO } from '../../src/lib/branding';

export const config = {
Comment on lines +5 to 7
Copy link

Copilot AI Mar 4, 2026

Choose a reason for hiding this comment

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

This file still hard-codes Opal logo normalization inline (item.appSlug === 'opal' ? OPAL_CANONICAL_LOGO : ...). Since normalizeOpalLogo now exists as the centralized normalizer, consider applying it to the pinned-app objects here as well to avoid duplicating the normalization rule in multiple places.

Copilot uses AI. Check for mistakes.
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@copilot open a new pull request to apply changes based on this feedback

runtime: 'edge',
};

const OPAL_CANONICAL_LOGO = '/icons/opal2.png';

const connectionString = process.env.DATABASE_URL;
if (!connectionString) {
throw new Error('DATABASE_URL environment variable is not set');
Expand Down
13 changes: 1 addition & 12 deletions api/profile/manage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,12 @@ import { neon } from '@neondatabase/serverless';
import { drizzle } from 'drizzle-orm/neon-http';
import { users, userProfileApps, apps, appSubmissions, userPreferences } from '../../src/db/schema';
import { eq, and, inArray } from 'drizzle-orm';
import { normalizeOpalLogo } from '../../src/lib/branding';

export const config = {
runtime: 'edge',
};

const OPAL_CANONICAL_LOGO = '/icons/opal2.png';

function normalizeOpalLogo<T extends { slug: string | null; logoUrl: string | null }>(app: T): T {
if (app.slug === 'opal') {
return {
...app,
logoUrl: OPAL_CANONICAL_LOGO,
};
}
return app;
}

const connectionString = process.env.DATABASE_URL;
if (!connectionString) {
throw new Error('DATABASE_URL environment variable is not set');
Expand Down
29 changes: 1 addition & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions src/components/PersonalProfile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -122,17 +122,17 @@ export function PersonalProfile({ slug }: { slug: string }) {
};

const handleAddExistingApp = async (appId: string): Promise<boolean> => {
const alreadyPinned = preferences.pinnedApps?.includes(appId);
if (!alreadyPinned) {
togglePinnedApp(appId);
}

const added = await addAppToProfile(appId);
if (!added) {
addToast('Failed to add app to profile', 'error');
return false;
}

const alreadyPinned = preferences.pinnedApps?.includes(appId);
if (!alreadyPinned) {
togglePinnedApp(appId);
}

addToast('App added to profile', 'success');
loadProfile();
return true;
Expand Down
11 changes: 11 additions & 0 deletions src/lib/branding.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
export const OPAL_CANONICAL_LOGO = '/icons/opal2.png';

export function normalizeOpalLogo<T extends { slug: string | null; logoUrl: string | null }>(app: T): Omit<T, 'logoUrl'> & { logoUrl: string | null } {
if (app.slug === 'opal') {
return {
...app,
logoUrl: OPAL_CANONICAL_LOGO,
};
}
return app;
}