Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make ambassador cards shiny #161

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"@alveusgg/data": "github:alveusgg/data#0.37.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-parallax-tilt": "^1.7.222",
"tmi.js": "^1.8.5"
},
"devDependencies": {
Expand Down
20 changes: 17 additions & 3 deletions src/components/ambassadorCard/AmbassadorCard.tsx
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only remaining issue looks to be that the tooltip on conservation status is now showing in the middle of nowhere?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good spot! Let me take a look

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👋 @farrenr checking in if you had a chance to look at this?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey! Apologies on taking a while with this, I've been a bit stuck on the last issue with the tooltip but I'm looking at it today

Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ import moderatorBadge from "../../assets/mod.svg";

import styles from "./ambassadorCard.module.scss";

import Tilt from "react-parallax-tilt";

const offsetPosition = (position: AmbassadorImage["position"]) => {
const [x, y] = (position || "50% 50%").split(" ");
return `${x} min(calc(${y} + 1.5rem), 0%)`;
Expand All @@ -28,17 +30,29 @@ export interface AmbassadorCardProps {
ambassador: AmbassadorType;
onClose?: () => void;
className?: string;
disableCardEffects?: boolean;
}

export default function AmbassadorCard(props: AmbassadorCardProps) {
const { ambassadorKey, ambassador, onClose, className } = props;
const { ambassadorKey, ambassador, onClose, className, disableCardEffects } =
props;
const images = getAmbassadorImages(ambassadorKey);
const mod =
window?.Twitch?.ext?.viewer?.role === "broadcaster" ||
window?.Twitch?.ext?.viewer?.role === "moderator";
const glareOpacity = disableCardEffects ? 0.0 : 0.3;

return (
<div
<Tilt
tiltEnable={!disableCardEffects}
glareEnable={!disableCardEffects}
glareMaxOpacity={glareOpacity}
glareBorderRadius="1rem"
glarePosition="bottom"
scale={1.0}
perspective={2500}
farrenr marked this conversation as resolved.
Show resolved Hide resolved
tiltReverse
transitionSpeed={3000}
className={classes(
styles.ambassadorCard,
className,
Expand Down Expand Up @@ -163,6 +177,6 @@ export default function AmbassadorCard(props: AmbassadorCardProps) {
</p>
</div>
</div>
</div>
</Tilt>
);
}
4 changes: 3 additions & 1 deletion src/components/ambassadorCard/ambassadorCard.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
box-shadow: $shadow;

border-radius: 1rem;
overflow: hidden;
overflow: visible;

color: $primary-text;
font-size: 0.7rem;
Expand All @@ -41,6 +41,7 @@
width: 100%;
object-fit: cover;
aspect-ratio: 2.2;
border-radius: 1rem 1rem 0rem 0rem;

@media (min-width: 480px) {
aspect-ratio: 1.8;
Expand All @@ -64,6 +65,7 @@
backdrop-filter: blur(0.25rem);
transition: $transition;
transition-property: opacity, backdrop-filter;
border-radius: 1rem 1rem 0rem 0rem;

.name {
font-size: 1.3rem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import type { OverlayOptionProps } from "../Overlay";
import styles from "./ambassadors.module.scss";
import IconChevron from "../../../../../components/icons/IconChevron";

import useSettings from "../../../hooks/useSettings";

export default function Ambassadors(props: OverlayOptionProps) {
const {
context: { activeAmbassador, setActiveAmbassador },
Expand Down Expand Up @@ -84,6 +86,8 @@ export default function Ambassadors(props: OverlayOptionProps) {
handleArrowVisibility();
}, [handleArrowVisibility]);

const settings = useSettings();

return (
<div className={classes(styles.ambassadorList, className)}>
<div className={styles.scroll}>
Expand Down Expand Up @@ -136,6 +140,7 @@ export default function Ambassadors(props: OverlayOptionProps) {
ambassador={ambassadors[activeAmbassador.key]}
onClose={() => setActiveAmbassador({})}
className={styles.ambassadorCard}
disableCardEffects={settings.disableCardEffects.value}
/>
)}
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ $fade-distance: 3rem;
.ambassadorCard {
align-self: center;
z-index: 0; // stay below ambassadors list
transform-origin: center left;
animation: slideIn 0.5s ease-in-out;

@media (prefers-reduced-motion) {
Expand Down
6 changes: 6 additions & 0 deletions src/pages/overlay/hooks/useSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const settings = {
},
configurable: false,
},
disableCardEffects: {
title: "Disable Ambassador Card Effects",
type: "boolean",
process: (value: any) => !!value,
configurable: true,
},
};

type SettingsKey = keyof typeof settings;
Expand Down