feat: update download page title to use display name
- Add Project interface with name and displayName - Fetch projects via SWR - Add getProjectDisplayName helper function - Use display name in the download page title Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,9 +2,15 @@
|
||||
'use client';
|
||||
|
||||
import { useState } from 'react';
|
||||
import useSWR from 'swr';
|
||||
import SearchForm from './SearchForm';
|
||||
import ApkList from './ApkList';
|
||||
|
||||
interface Project {
|
||||
name: string;
|
||||
displayName: string;
|
||||
}
|
||||
|
||||
export default function DownloadPage() {
|
||||
const [searchParams, setSearchParams] = useState({
|
||||
project: '',
|
||||
@@ -12,10 +18,17 @@ export default function DownloadPage() {
|
||||
commitId: '',
|
||||
});
|
||||
|
||||
const { data: projects } = useSWR<Project[]>('/api/projects');
|
||||
|
||||
const handleSearch = (project: string, version: string, commitId: string) => {
|
||||
setSearchParams({ project, version, commitId });
|
||||
};
|
||||
|
||||
const getProjectDisplayName = (projectName: string): string => {
|
||||
const project = projects?.find(p => p.name === projectName);
|
||||
return project?.displayName || projectName;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="min-h-screen bg-gray-50">
|
||||
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-8">
|
||||
@@ -33,7 +46,7 @@ export default function DownloadPage() {
|
||||
{searchParams.project && searchParams.version ? (
|
||||
<>
|
||||
<h2 className="text-xl font-semibold text-gray-800 mb-4">
|
||||
{searchParams.project} - {searchParams.version.replace('_', '.')}
|
||||
{getProjectDisplayName(searchParams.project)} - {searchParams.version.replace('_', '.')}
|
||||
{searchParams.commitId && ` (commit: ${searchParams.commitId})`}
|
||||
</h2>
|
||||
<ApkList
|
||||
|
||||
Reference in New Issue
Block a user