MCPcopy Create free account
hub / github.com/TheOrcDev/github-creature / CreatureCard

Function CreatureCard

components/creature-card.tsx:208–383  ·  view source on GitHub ↗
({
  username,
  stats,
}: CreatureCardProps)

Source from the content-addressed store, hash-verified

206};
207
208export default async function CreatureCard({
209 username,
210 stats,
211}: CreatureCardProps) {
212 const usernameLower = username.toLowerCase();
213 const githubProfileUrl = `https://github.com/${usernameLower}`;
214
215 const creature = await getCreatureByGithubUsername(usernameLower);
216
217 if (!creature) {
218 return (
219 <div className="grid w-full place-content-center gap-5 bg-background px-4 text-center">
220 <Image
221 alt="GitHub Creature 404"
222 height={300}
223 src={"/github-creature-logo.png"}
224 width={300}
225 />
226
227 <h1 className="font-bold text-2xl tracking-tight sm:text-4xl">
228 Creature not found
229 </h1>
230
231 <p className="text-gray-500">
232 The creature you are looking for does not exist.
233 </p>
234 <Link
235 href={serializeFormSearchParams("/", { username: usernameLower })}
236 >
237 <Button variant={"outline"}>Summon it</Button>
238 </Link>
239 </div>
240 );
241 }
242
243 const theme = getPowerLevelTheme(creature.powerLevel);
244 const emblemTheme = getEmblemTheme(creature.powerLevel);
245 const toggleId = `stats-toggle-${usernameLower}`;
246 const cardDomId = `creature-card-${usernameLower}`;
247
248 return (
249 <div className="flex flex-col items-center dark">
250 <div className="flex flex-col sm:flex-row items-start gap-4">
251 <input id={toggleId} type="checkbox" className="peer sr-only" />
252
253 <div
254 className={cn(
255 "relative transition-transform duration-500 ease-out",
256 "peer-checked:sm:-translate-x-1",
257 "peer-checked:**:data-[state=reveal]:hidden",
258 "peer-checked:**:data-[state=hide]:inline",
259 "peer-checked:**:data-[slot=arrow]:rotate-180"
260 )}
261 >
262 {stats && (
263 <div className="absolute -top-10 right-0 z-10 flex justify-end mr-6">
264 <div className="lg:hidden w-full">
265 <CreatureStatsDialog triggerText="View stats">

Callers

nothing calls this directly

Calls 4

cnFunction · 0.90
getPowerLevelThemeFunction · 0.85
getEmblemThemeFunction · 0.85

Tested by

no test coverage detected