Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds Project Update state & its corresponding descp in Wonderdome #796

Merged
merged 2 commits into from
Nov 17, 2024
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
4 changes: 4 additions & 0 deletions src/app/api/battles/matchups/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ export async function GET() {
repo_url: matchup.project1.repo_url,
deploy_url: matchup.project1.deploy_url,
rating: matchup.project1.rating,
ship_type: matchup.project1.ship_type,
update_description: matchup.project1.update_description,
},
project2: {
id: matchup.project2.id,
Expand All @@ -63,6 +65,8 @@ export async function GET() {
repo_url: matchup.project2.repo_url,
deploy_url: matchup.project2.deploy_url,
rating: matchup.project2.rating,
ship_type: matchup.project2.ship_type,
update_description: matchup.project2.update_description,
},
signature: matchup.signature,
ts: matchup.ts,
Expand Down
38 changes: 35 additions & 3 deletions src/app/harbor/battles/battles.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,13 @@ const ProjectCard: React.FC<ProjectCardProps> = ({
backgroundImage: `url(${notFoundImage})`,
backgroundSize: 'cover',
}
const [showFullText, setShowFullText] = useState(false)

const toggleReadMore = () => {
setShowFullText((prev) => !prev)
}

const truncatedText = project.update_description?.slice(0, 50)

return (
<div className="bg-white dark:bg-gray-800 rounded-lg overflow-hidden shadow-lg transition-all duration-300 hover:shadow-xl">
Expand All @@ -73,10 +80,19 @@ const ProjectCard: React.FC<ProjectCardProps> = ({
<div className="p-6">
<h2 className="font-heading text-2xl font-semibold text-indigo-600 dark:text-indigo-300 mb-4">
{project.title}
{project.ship_type === 'update' ? (
<p className="text-gray-600 dark:text-gray-300 mb-4 inline">
{' '}
<Pill
msg="This is a project update"
color="green"
glyph="rep"
classes="text-lg"
/>
</p>
) : null}
</h2>
{/* <p className="text-gray-600 dark:text-gray-300 mb-4">
Hours: {project.hours}
</p> */}

<div className="flex flex-wrap gap-2 mb-4">
{project.repo_url && (
<a
Expand Down Expand Up @@ -114,6 +130,22 @@ const ProjectCard: React.FC<ProjectCardProps> = ({
</button>
)}
</div>
{project.update_description && (
<p className="mt-4">
{showFullText
? project.update_description
: truncatedText +
(project.update_description.length > 50 ? '...' : '')}
{project.update_description.length > 50 && (
<button
className="text-blue-500 ml-2 underline"
onClick={toggleReadMore}
>
{showFullText ? 'Read Less' : 'Read More'}
</button>
)}
</p>
)}
</div>
<div className="p-4 bg-gray-100 dark:bg-gray-700">
<button
Expand Down
2 changes: 2 additions & 0 deletions types/battles/airtable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export interface Ships extends FieldSet {
autonumber?: number
screenshot_url: string
entrant__slack_id: string[]
ship_type?: string
update_description?: string
}

export interface Battles extends FieldSet {
Expand Down
Loading