Preskoči na vsebino

std-flip-card

Level: Atom | Entity: Flashcard | Persistence: runtime

2 states, 4 events, 4 transitions

Live Preview

orbital FlashcardOrbital {
entity Flashcard [runtime] {
id : string
name : string
description : string
status : string
createdAt : string
question : string
answer : string
}
trait FlashcardFlipCard -> Flashcard [interaction] {
initial: front
state front {
INIT -> front
(fetch Flashcard)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "rotate-3d", size: "lg" }, { type: "typography", content: "Flashcards Flashcards", variant: "h2" }] }, { type: "divider" }, { type: "flip-card", front: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "help-circle", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "name"] }, { type: "typography", variant: "caption", color: "muted", content: "Tap to reveal answer" }] }, back: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "lightbulb", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "description"] }, { type: "badge", label: "Answer" }] }, flipped: false }, { type: "button", label: "Flip", event: "FLIP", variant: "primary", icon: "rotate-3d" }] })
FLIP -> back
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "rotate-3d", size: "lg" }, { type: "typography", content: "Flashcards Flashcards", variant: "h2" }] }, { type: "divider" }, { type: "flip-card", front: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "help-circle", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "name"] }, { type: "typography", variant: "caption", color: "muted", content: "Tap to reveal answer" }] }, back: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "lightbulb", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "description"] }, { type: "badge", label: "Answer" }] }, flipped: true }, { type: "stack", direction: "horizontal", gap: "sm", justify: "center", children: [{ type: "button", label: "Flip Back", event: "FLIP_BACK", variant: "ghost", icon: "rotate-3d" }, { type: "button", label: "Next", event: "NEXT", variant: "primary", icon: "arrow-right" }] }] })
}
state back {
FLIP_BACK -> front
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "rotate-3d", size: "lg" }, { type: "typography", content: "Flashcards Flashcards", variant: "h2" }] }, { type: "divider" }, { type: "flip-card", front: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "help-circle", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "name"] }, { type: "typography", variant: "caption", color: "muted", content: "Tap to reveal answer" }] }, back: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "lightbulb", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "description"] }, { type: "badge", label: "Answer" }] }, flipped: false }, { type: "button", label: "Flip", event: "FLIP", variant: "primary", icon: "rotate-3d" }] })
NEXT -> front
(fetch Flashcard)
(render-ui main { type: "stack", direction: "vertical", gap: "lg", align: "center", children: [{ type: "stack", direction: "horizontal", gap: "sm", align: "center", children: [{ type: "icon", name: "rotate-3d", size: "lg" }, { type: "typography", content: "Flashcards Flashcards", variant: "h2" }] }, { type: "divider" }, { type: "flip-card", front: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "help-circle", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "name"] }, { type: "typography", variant: "caption", color: "muted", content: "Tap to reveal answer" }] }, back: { type: "stack", direction: "vertical", gap: "md", align: "center", children: [{ type: "icon", name: "lightbulb", size: "lg" }, { type: "typography", variant: "h3", content: ["object/get", ["array/first", "@entity"], "description"] }, { type: "badge", label: "Answer" }] }, flipped: false }, { type: "button", label: "Flip", event: "FLIP", variant: "primary", icon: "rotate-3d" }] })
}
}
page "/flashcards/flashcards" -> FlashcardFlipCard
}
Loading preview...

Orbital Visualization

Loading visualization...

Entity Fields

FieldTypeDefault
idstring-
namestring-
descriptionstring-
statusstring"active"
createdAtstring-
questionstring""
answerstring""

States

StateType
frontInitial
back-

Events

EventPayload
INIT-
FLIP-
FLIP_BACK-
NEXT-

Transitions

FromEventToEffects
frontINITfront2 effects
frontFLIPback1 effect
backFLIP_BACKfront1 effect
backNEXTfront2 effects