khagu Claude Opus 4.5 commited on
Commit
f1588df
·
1 Parent(s): 4a3c2fc

fix: add project image display and view link functionality

Browse files

- Add link and image columns to projects table schema
- Fix image display to handle both URLs and gradients
- Make View button navigate to project link

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Frontend/components/featured-projects.tsx CHANGED
@@ -78,7 +78,14 @@ export function FeaturedProjects() {
78
  {/* Project Image */}
79
  <div
80
  className="h-36 sm:h-40 md:h-48 bg-cover bg-center group-hover:scale-110 transition-transform duration-300"
81
- style={{ background: project.image || 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)' }}
 
 
 
 
 
 
 
82
  role="img"
83
  aria-label={`${project.title} project visual`}
84
  />
@@ -109,13 +116,27 @@ export function FeaturedProjects() {
109
  <div className="text-xs sm:text-sm text-muted-foreground">
110
  <span className="font-semibold text-foreground">{project.contributors || 0}</span> contributors
111
  </div>
112
- <Button
113
- variant="ghost"
114
- size="sm"
115
- className="text-primary hover:text-primary/80 text-xs sm:text-sm px-2 sm:px-3"
116
- >
117
- View <ArrowRight className="w-3 h-3 sm:w-4 sm:h-4 ml-1 sm:ml-2" aria-hidden="true" />
118
- </Button>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  </div>
120
  </div>
121
  </article>
 
78
  {/* Project Image */}
79
  <div
80
  className="h-36 sm:h-40 md:h-48 bg-cover bg-center group-hover:scale-110 transition-transform duration-300"
81
+ style={{
82
+ background: project.image?.startsWith('linear-gradient') || !project.image
83
+ ? (project.image || 'linear-gradient(135deg, #667eea 0%, #764ba2 100%)')
84
+ : undefined,
85
+ backgroundImage: project.image && !project.image.startsWith('linear-gradient')
86
+ ? `url(${project.image})`
87
+ : undefined
88
+ }}
89
  role="img"
90
  aria-label={`${project.title} project visual`}
91
  />
 
116
  <div className="text-xs sm:text-sm text-muted-foreground">
117
  <span className="font-semibold text-foreground">{project.contributors || 0}</span> contributors
118
  </div>
119
+ {project.link ? (
120
+ <Button
121
+ variant="ghost"
122
+ size="sm"
123
+ className="text-primary hover:text-primary/80 text-xs sm:text-sm px-2 sm:px-3"
124
+ asChild
125
+ >
126
+ <a href={project.link} target="_blank" rel="noopener noreferrer">
127
+ View <ArrowRight className="w-3 h-3 sm:w-4 sm:h-4 ml-1 sm:ml-2" aria-hidden="true" />
128
+ </a>
129
+ </Button>
130
+ ) : (
131
+ <Button
132
+ variant="ghost"
133
+ size="sm"
134
+ className="text-primary hover:text-primary/80 text-xs sm:text-sm px-2 sm:px-3"
135
+ disabled
136
+ >
137
+ View <ArrowRight className="w-3 h-3 sm:w-4 sm:h-4 ml-1 sm:ml-2" aria-hidden="true" />
138
+ </Button>
139
+ )}
140
  </div>
141
  </div>
142
  </article>
app/schemas/project.py CHANGED
@@ -7,6 +7,8 @@ class Project(BaseModel):
7
  description: str | None = None
8
  github_url: str | None = None
9
  live_url: str | None = None
 
 
10
  created_at: datetime
11
 
12
  class ProjectCreate(BaseModel):
@@ -14,3 +16,5 @@ class ProjectCreate(BaseModel):
14
  description: str | None = None
15
  github_url: str | None = None
16
  live_url: str | None = None
 
 
 
7
  description: str | None = None
8
  github_url: str | None = None
9
  live_url: str | None = None
10
+ link: str | None = None
11
+ image: str | None = None
12
  created_at: datetime
13
 
14
  class ProjectCreate(BaseModel):
 
16
  description: str | None = None
17
  github_url: str | None = None
18
  live_url: str | None = None
19
+ link: str | None = None
20
+ image: str | None = None
supabase/migrations/20260126_create_tables.sql CHANGED
@@ -8,6 +8,8 @@ CREATE TABLE IF NOT EXISTS projects (
8
  description TEXT,
9
  github_url TEXT,
10
  live_url TEXT,
 
 
11
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
12
  );
13
 
 
8
  description TEXT,
9
  github_url TEXT,
10
  live_url TEXT,
11
+ link TEXT,
12
+ image TEXT,
13
  created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
14
  );
15