Home / Function/ CardsActivityGoal() — ui Function Reference

CardsActivityGoal() — ui Function Reference

Architecture documentation for the CardsActivityGoal() function in activity-goal.tsx from the ui codebase.

Entity Profile

Dependency Diagram

graph TD
  72744a55_564e_8e05_be2a_9c54c7f1b5d3["CardsActivityGoal()"]
  79610234_921c_7c29_c9f2_f401327be480["activity-goal.tsx"]
  72744a55_564e_8e05_be2a_9c54c7f1b5d3 -->|defined in| 79610234_921c_7c29_c9f2_f401327be480
  style 72744a55_564e_8e05_be2a_9c54c7f1b5d3 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

deprecated/www/components/cards/activity-goal.tsx lines 67–125

export function CardsActivityGoal() {
  const [goal, setGoal] = React.useState(350)

  function onClick(adjustment: number) {
    setGoal(Math.max(200, Math.min(400, goal + adjustment)))
  }

  return (
    <Card>
      <CardHeader className="pb-4">
        <CardTitle>Move Goal</CardTitle>
        <CardDescription>Set your daily activity goal.</CardDescription>
      </CardHeader>
      <CardContent className="pb-2">
        <div className="flex items-center justify-center space-x-2">
          <Button
            variant="outline"
            size="icon"
            className="h-8 w-8 shrink-0 rounded-full"
            onClick={() => onClick(-10)}
            disabled={goal <= 200}
          >
            <Minus />
            <span className="sr-only">Decrease</span>
          </Button>
          <div className="flex-1 text-center">
            <div className="text-5xl font-bold tracking-tighter">{goal}</div>
            <div className="text-[0.70rem] uppercase text-muted-foreground">
              Calories/day
            </div>
          </div>
          <Button
            variant="outline"
            size="icon"
            className="h-8 w-8 shrink-0 rounded-full"
            onClick={() => onClick(10)}
            disabled={goal >= 400}
          >
            <Plus />
            <span className="sr-only">Increase</span>
          </Button>
        </div>
        <div className="my-3 h-[60px]">
          <ChartContainer
            config={chartConfig}
            className="aspect-auto h-full w-full"
          >
            <BarChart data={data}>
              <Bar dataKey="goal" radius={4} fill="var(--color-goal)" />
            </BarChart>
          </ChartContainer>
        </div>
      </CardContent>
      <CardFooter>
        <Button className="w-full">Set Goal</Button>
      </CardFooter>
    </Card>
  )
}

Subdomains

Frequently Asked Questions

What does CardsActivityGoal() do?
CardsActivityGoal() is a function in the ui codebase, defined in deprecated/www/components/cards/activity-goal.tsx.
Where is CardsActivityGoal() defined?
CardsActivityGoal() is defined in deprecated/www/components/cards/activity-goal.tsx at line 67.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free