Skip to content

Commit

Permalink
replaced string with type
Browse files Browse the repository at this point in the history
  • Loading branch information
FrantaBOT committed Sep 25, 2024
1 parent 5e3dbd2 commit 48d7bb7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions src/app/chat/Badge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,18 @@ import BadgeTooltip from "./BadgeTooltip.vue";
const props = defineProps<{
alt: string;
type: "twitch" | "picture" | "app";
badge: Twitch.ChatBadge | string | SevenTV.Cosmetic<"BADGE">;
badge: Twitch.ChatBadge | Twitch.SharedChat | SevenTV.Cosmetic<"BADGE">;
}>();
const backgroundColor = ref("");
const borderRadius = ref("");
const srcset = {
twitch: (badge: Twitch.ChatBadge) => `${badge.image1x} 1x, ${badge.image2x} 2x, ${badge.image4x} 4x`,
picture: (badge: string) => `${badge.slice(0, -9)}28x28.png 1.6x, ${badge.slice(0, -9)}70x70.png 3.8x`,
picture: (badge: Twitch.SharedChat) =>
`${badge.profileImageURL.slice(0, -9)}28x28.png 1.6x, ${badge.profileImageURL.slice(0, -9)}70x70.png 3.8x`,
app: (badge: SevenTV.Cosmetic<"BADGE">) =>
badge.data.host.files.map((fi, i) => `https:${badge.data.host.url}/${fi.name} ${i + 1}x`).join(", "),
}[props.type](props.badge as SevenTV.Cosmetic<"BADGE"> & string & Twitch.ChatBadge);
}[props.type](props.badge as SevenTV.Cosmetic<"BADGE"> & Twitch.SharedChat & Twitch.ChatBadge);
const imgRef = ref<HTMLElement>();
Expand Down
2 changes: 1 addition & 1 deletion src/app/chat/UserTag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<Badge
v-if="sourceData"
:key="sourceData.login"
:badge="sourceData.profileImageURL"
:badge="sourceData"
:alt="sourceData.displayName"
type="picture"
/>
Expand Down

0 comments on commit 48d7bb7

Please sign in to comment.