Match Highlight Adapter (Mr. Doge SDK)
mrdoge-ui/mrdoge-match-highlight-adapterFreeUtility
Maps a real matches.get()/matches.subscribe() response onto Match Highlight's props.
Install it
npx shadcn@latest add https://mrdoge.co/r/mrdoge-match-highlight-adapter.jsonSource
1import type { Match, MatchDetail } from "@mrdoge/protocol"2import type { MatchHighlightCompetitionMatch, MatchHighlightDataProps } from "@/registry/mrdoge-ui/match-highlight/match-highlight"34// Public, unauthenticated, cached CDN. Not part of the Team/Region shape5// itself. See /docs/reference/images.6function teamLogoUrl(teamId: number) {7 return `https://api.mrdoge.co/images/teams/${teamId}.png`8}910function regionLogoUrl(regionId: number) {11 return `https://api.mrdoge.co/images/regions/${regionId}.png`12}1314/**15 * Maps a real `matches.get()` / `matches.subscribe()` response to Match16 * Highlight's props. If the SDK's shape changes, this fails to compile.17 *18 * Cards and corners are soccer-specific. MatchStats is a discriminated19 * union per sport, so this narrows before reading them; other sports get20 * no stats row at all rather than misleading zeros.21 *22 * Doesn't populate `competitionMatches`/`onOpenCompetitionMatches`/23 * `onSelectCompetitionMatch`: those need a live query for "other matches24 * today in this competition", which a single-match adapter can't run on25 * its own. Add them at the call site (see the demo).26 */27export function matchToMatchHighlightProps(match: MatchDetail): MatchHighlightDataProps {28 const stats = match.stats?.sport === "soccer" ? match.stats : undefined29 const clock = match.stats?.clock3031 return {32 status: match.status,33 competition: match.competition.name,34 region: { name: match.region.name, logoUrl: regionLogoUrl(match.region.id) },35 kickoff: match.startTime,36 home: {37 name: match.homeTeam.name,38 logoUrl: teamLogoUrl(match.homeTeam.id),39 yellowCards: stats?.homeYellowCards,40 redCards: stats?.homeRedCards,41 corners: stats?.homeCorners,42 },43 away: {44 name: match.awayTeam.name,45 logoUrl: teamLogoUrl(match.awayTeam.id),46 yellowCards: stats?.awayYellowCards,47 redCards: stats?.awayRedCards,48 corners: stats?.awayCorners,49 },50 homeScore: match.stats?.homeScore,51 awayScore: match.stats?.awayScore,52 clock: clock53 ? {54 state: clock.state,55 display: clock.display,56 displayLong: clock.displayLong,57 elapsedSeconds: clock.elapsedSeconds,58 referenceTime: clock.referenceTime,59 minute: clock.minute,60 stoppage: clock.stoppage,61 }62 : undefined,63 }64}6566function toCompetitionMatchInfo(match: Match): string | undefined {67 if (match.status === "upcoming") {68// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from mrdoge-ui
All 26 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Bet Slip Adapter (Mr. Doge SDK)mrdoge-bet-slip-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Mr. Doge Clientmrdoge-client | mrdoge-ui | Utilities | Free | 1 dep | |
| Conflict Adapter (Mr. Doge SDK)mrdoge-conflict-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Match Card Adapter (Mr. Doge SDK)mrdoge-match-card-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Match Timeline Adapter (Mr. Doge SDK)mrdoge-match-timeline-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Odds Selector Adapter (Mr. Doge SDK)mrdoge-odds-selector-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Stats List Adapter (Mr. Doge SDK)mrdoge-stats-list-adapter | mrdoge-ui | Utilities | Free | 1 dep | |
| Rate Limitrate-limit | mrdoge-ui | Utilities | Free | no deps |
