Skip to content

Commit af4e5a0

Browse files
authored
Academy/Codebase Entrepreneur: Module 10 Grant Application (#2733)
* test layout * cccccburbdjtlkheefgkidblnevdtjnbkcbfedcfbviu * flashcad component in the works * added correct instructors * added boilerplate chapters + new banner testing * fixed banner to mp4 * moved flashcards into their own folders in components * fixed build error + banner video view on phone
1 parent a8e4e64 commit af4e5a0

File tree

21 files changed

+780
-31
lines changed

21 files changed

+780
-31
lines changed
Lines changed: 270 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,270 @@
1+
"use client"
2+
import type React from "react"
3+
import { useState, useEffect } from "react"
4+
import { ChevronLeft, ChevronRight, RotateCw, Eye, EyeOff } from "lucide-react"
5+
import { cn } from "@/lib/utils"
6+
import { Button } from "@/components/ui/button"
7+
import { saveFlashcardProgress, getFlashcardProgress, resetFlashcardProgress } from "@/utils/quizzes/indexedDB"
8+
9+
interface FlashcardProps {
10+
flashcardSetId: string
11+
}
12+
13+
interface FlashcardDataItem {
14+
term: string
15+
definition: string
16+
example?: string
17+
}
18+
19+
const flashcardData: Record<string, FlashcardDataItem[]> = {
20+
"grants-process": [
21+
{
22+
term: "Foundation Grants vs. VC Funding",
23+
definition: "Unlike VCs seeking ROI, foundation grants prioritize ecosystem impact",
24+
example: "A project creating open-source infrastructure that many can build upon",
25+
},
26+
{
27+
term: "Ecosystem Fit",
28+
definition: "How well your project addresses a specific gap or need in the Avalanche ecosystem",
29+
example: "Building privacy solutions that enable real-world business transactions on Avalanche",
30+
},
31+
{
32+
term: "Proof of Shipping",
33+
definition: "Evidence that demonstrates your ability to execute and deliver on your roadmap",
34+
example: "A working prototype on Fuji testnet that shows core functionality",
35+
},
36+
{
37+
term: "Grant Hunting",
38+
definition: "Applying for grants across multiple ecosystems without customization or commitment",
39+
example:
40+
"Submitting identical proposals to Avalanche, Solana, and Ethereum without blockchain-specific considerations",
41+
},
42+
{
43+
term: "Business Development Support",
44+
definition: "Connections and introductions provided by the foundation to help your project grow",
45+
example: "Getting introduced to institutional custodians that would be difficult to reach independently",
46+
},
47+
],
48+
}
49+
50+
const CleanFlashcard: React.FC<FlashcardProps> = ({ flashcardSetId }) => {
51+
const [flashcards] = useState<FlashcardDataItem[]>(flashcardData[flashcardSetId] || [])
52+
const [currentIndex, setCurrentIndex] = useState(0)
53+
const [isRevealed, setIsRevealed] = useState(false)
54+
const [viewedCards, setViewedCards] = useState<Set<number>>(new Set())
55+
const [isLoading, setIsLoading] = useState(true)
56+
57+
useEffect(() => {
58+
const loadProgress = async () => {
59+
try {
60+
const savedProgress = await getFlashcardProgress(flashcardSetId)
61+
if (savedProgress) {
62+
setCurrentIndex(savedProgress.currentIndex)
63+
setViewedCards(new Set(savedProgress.viewedCards))
64+
}
65+
} catch (error) {
66+
console.error("Failed to load flashcard progress:", error)
67+
} finally {
68+
setIsLoading(false)
69+
}
70+
}
71+
loadProgress()
72+
}, [flashcardSetId])
73+
74+
useEffect(() => {
75+
if (!isLoading && flashcards.length > 0) {
76+
const saveProgress = async () => {
77+
try {
78+
await saveFlashcardProgress(flashcardSetId, {
79+
currentIndex,
80+
viewedCards: Array.from(viewedCards),
81+
totalCards: flashcards.length,
82+
})
83+
} catch (error) {
84+
console.error("Failed to save flashcard progress:", error)
85+
}
86+
}
87+
saveProgress()
88+
}
89+
}, [currentIndex, viewedCards, flashcardSetId, flashcards.length, isLoading])
90+
91+
const currentCard = flashcards[currentIndex]
92+
const progress = (viewedCards.size / flashcards.length) * 100
93+
94+
const handleReveal = () => {
95+
if (!isRevealed) {
96+
setViewedCards((prev) => new Set([...prev, currentIndex]))
97+
}
98+
setIsRevealed(!isRevealed)
99+
}
100+
101+
const handleNext = () => {
102+
if (currentIndex < flashcards.length - 1) {
103+
setCurrentIndex(currentIndex + 1)
104+
setIsRevealed(false)
105+
}
106+
}
107+
108+
const handlePrevious = () => {
109+
if (currentIndex > 0) {
110+
setCurrentIndex(currentIndex - 1)
111+
setIsRevealed(false)
112+
}
113+
}
114+
115+
const handleReset = async () => {
116+
try {
117+
await resetFlashcardProgress(flashcardSetId)
118+
setCurrentIndex(0)
119+
setIsRevealed(false)
120+
setViewedCards(new Set())
121+
} catch (error) {
122+
console.error("Failed to reset flashcard progress:", error)
123+
}
124+
}
125+
126+
if (isLoading) {
127+
return (
128+
<div className="flex items-center justify-center p-4">
129+
<div className="w-full max-w-2xl bg-card shadow-lg rounded-lg p-8">
130+
<div className="text-center text-muted-foreground">Loading flashcards...</div>
131+
</div>
132+
</div>
133+
)
134+
}
135+
136+
if (flashcards.length === 0) {
137+
return (
138+
<div className="flex items-center justify-center p-4">
139+
<div className="w-full max-w-2xl bg-card shadow-lg rounded-lg p-8">
140+
<div className="text-center text-muted-foreground">No flashcards found for this set.</div>
141+
</div>
142+
</div>
143+
)
144+
}
145+
146+
return (
147+
<div className="flex items-center justify-center p-4">
148+
<div className="w-full max-w-2xl bg-card shadow-lg rounded-lg overflow-hidden border">
149+
{/* Header */}
150+
<div className="text-center p-6 border-b">
151+
<h2 className="text-xl font-semibold mb-2">Study Flashcards</h2>
152+
<p className="text-sm text-muted-foreground">Click reveal to see the answer and track your progress</p>
153+
</div>
154+
155+
{/* Progress */}
156+
<div className="p-4 bg-muted/30">
157+
<div className="flex justify-between text-sm text-muted-foreground mb-2">
158+
<span>
159+
Progress: {viewedCards.size} / {flashcards.length} cards
160+
</span>
161+
<span>{Math.round(progress)}%</span>
162+
</div>
163+
<div className="w-full bg-secondary rounded-full h-2">
164+
<div
165+
className="bg-primary h-2 rounded-full transition-all duration-300"
166+
style={{ width: `${progress}%` }}
167+
/>
168+
</div>
169+
</div>
170+
171+
{/* Card Content */}
172+
<div className="p-8">
173+
<div className="text-center mb-6">
174+
<span className="text-sm font-medium text-muted-foreground uppercase tracking-wide">
175+
Card {currentIndex + 1} of {flashcards.length}
176+
</span>
177+
</div>
178+
179+
{/* Term */}
180+
<div className="text-center mb-8">
181+
<h3 className="text-2xl font-bold mb-2">{currentCard.term}</h3>
182+
</div>
183+
184+
{/* Answer Section */}
185+
<div
186+
className={cn(
187+
"min-h-[120px] p-6 rounded-lg border-2 transition-all duration-300",
188+
isRevealed ? "border-primary/20 bg-primary/5" : "border-border bg-muted/30",
189+
)}
190+
>
191+
{!isRevealed ? (
192+
<div className="flex flex-col items-center justify-center h-full text-center">
193+
<EyeOff className="h-8 w-8 text-muted-foreground mb-3" />
194+
<p className="text-muted-foreground">Click "Reveal Answer" to see the definition</p>
195+
</div>
196+
) : (
197+
<div className="space-y-4">
198+
<div>
199+
<h4 className="text-sm font-semibold text-primary mb-2 uppercase tracking-wide">Definition</h4>
200+
<p className="leading-relaxed">{currentCard.definition}</p>
201+
</div>
202+
{currentCard.example && (
203+
<div>
204+
<h4 className="text-sm font-semibold text-primary mb-2 uppercase tracking-wide">Example</h4>
205+
<p className="text-muted-foreground italic leading-relaxed">{currentCard.example}</p>
206+
</div>
207+
)}
208+
</div>
209+
)}
210+
</div>
211+
212+
{/* Reveal Button */}
213+
<div className="text-center mt-6">
214+
<Button onClick={handleReveal} variant={isRevealed ? "outline" : "default"} className="px-6">
215+
{isRevealed ? (
216+
<>
217+
<EyeOff className="h-4 w-4 mr-2" />
218+
Hide Answer
219+
</>
220+
) : (
221+
<>
222+
<Eye className="h-4 w-4 mr-2" />
223+
Reveal Answer
224+
</>
225+
)}
226+
</Button>
227+
</div>
228+
</div>
229+
230+
{/* Navigation */}
231+
<div className="p-6 bg-muted/30 border-t">
232+
<div className="flex justify-between items-center">
233+
<Button
234+
variant="outline"
235+
onClick={handlePrevious}
236+
disabled={currentIndex === 0}
237+
className="flex items-center gap-2 bg-transparent"
238+
>
239+
<ChevronLeft className="h-4 w-4" />
240+
Previous
241+
</Button>
242+
243+
<Button
244+
variant="outline"
245+
onClick={handleNext}
246+
disabled={currentIndex === flashcards.length - 1}
247+
className="flex items-center gap-2 bg-transparent"
248+
>
249+
Next
250+
<ChevronRight className="h-4 w-4" />
251+
</Button>
252+
</div>
253+
254+
{/* Completion Message */}
255+
{viewedCards.size === flashcards.length && (
256+
<div className="mt-6 text-center p-4 bg-primary/10 rounded-lg border border-primary/20">
257+
<p className="text-primary font-medium mb-3">🎉 Excellent! You've studied all flashcards!</p>
258+
<Button variant="secondary" onClick={handleReset} className="flex items-center gap-2 mx-auto">
259+
<RotateCw className="h-4 w-4" />
260+
Study Again
261+
</Button>
262+
</div>
263+
)}
264+
</div>
265+
</div>
266+
</div>
267+
)
268+
}
269+
270+
export default CleanFlashcard
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
{
2+
"courses": {
3+
"codebase-entrepreneur-academy": {
4+
"title": "Codebase Entrepreneur Academy",
5+
"flashcardSets": [
6+
"grants-process"
7+
]
8+
}
9+
},
10+
"flashcardSets": {
11+
"grants-process": [
12+
{
13+
"term": "Foundation Grants vs. VC Funding",
14+
"definition": "Unlike VCs seeking ROI, foundation grants prioritize ecosystem impact",
15+
"example": "A project creating open-source infrastructure that many can build upon"
16+
},
17+
{
18+
"term": "Ecosystem Fit",
19+
"definition": "How well your project addresses a specific gap or need in the Avalanche ecosystem",
20+
"example": "Building privacy solutions that enable real-world business transactions on Avalanche"
21+
},
22+
{
23+
"term": "Proof of Shipping",
24+
"definition": "Evidence that demonstrates your ability to execute and deliver on your roadmap",
25+
"example": "A working prototype on Fuji testnet that shows core functionality"
26+
},
27+
{
28+
"term": "Grant Hunting",
29+
"definition": "Applying for grants across multiple ecosystems without customization or commitment",
30+
"example": "Submitting identical proposals to Avalanche, Solana, and Ethereum without blockchain-specific considerations"
31+
},
32+
{
33+
"term": "Business Development Support",
34+
"definition": "Connections and introductions provided by the foundation to help your project grow",
35+
"example": "Getting introduced to institutional custodians that would be difficult to reach independently"
36+
}
37+
]
38+
}
39+
}

0 commit comments

Comments
 (0)