Skip to content

Commit

Permalink
refack PaymentAlerts, use different voices for alert title and message
Browse files Browse the repository at this point in the history
  • Loading branch information
stCarolas committed Jan 11, 2024
1 parent 1ccd505 commit ab5a252
Show file tree
Hide file tree
Showing 26 changed files with 684 additions and 372 deletions.
40 changes: 40 additions & 0 deletions package-lock.json

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

4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"@types/react-dom": "^18.2.13",
"@types/react-toggle": "^4.0.5",
"@types/uuid": "^9.0.7",
"@types/video.js": "^7.3.56",
"axios": "^1.5.1",
"bootstrap": "^5.3.1",
"howler": "^2.2.3",
Expand All @@ -24,6 +27,7 @@
"react-router-dom": "^6.15.0",
"react-scripts": "5.0.1",
"react-stomp": "^5.1.0",
"react-toggle": "^4.1.3",
"stomp-client": "^0.9.0",
"stompjs": "^2.3.3",
"talkify-tts": "^3.9.3",
Expand Down
Binary file added public/icons/laptop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/multimedia-player.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/icons/player-popup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/components/ConfigurationPage/ConfigurationPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const types = [
{ name: "payments", description: "Payment History" },
{ name: "player-control", description: "Music Player Remote Control" },
{ name: "donation-timer", description: "Donation Timer" },
{ name: "donation-timer", description: "Donation Timer" },
];

export default function ConfigurationPage({}: {}) {
Expand Down
3 changes: 3 additions & 0 deletions src/components/ConfigurationPage/WidgetSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,9 @@ const defaultSettings = {
"player-control": {
properties: [],
},
"player-popup": {
properties: [],
},
payments: {
properties: [
{
Expand Down
29 changes: 29 additions & 0 deletions src/components/FontLoader/FontLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, { useEffect, useState } from "react";
import FontImport from "../FontImport/FontImport";
import { IFontProvider } from "./IFontLoader";

export default function FontLoader({
fontProvider,
}: {
fontProvider: IFontProvider;
}) {
const [fonts, setFonts] = useState<string[]>([]);

useEffect(() => {
fontProvider.addFontLoader({
addFont: (font) => {
setFonts((oldFonts) => {
return Array.from(new Set(oldFonts).add(font));
});
},
});
}, [fontProvider]);

return (
<>
{fonts.map((font) => (
<FontImport key={font} font={font} />
))}
</>
);
}
6 changes: 6 additions & 0 deletions src/components/FontLoader/IFontLoader.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export interface IFontLoader {
addFont(font: string):void;
}
export interface IFontProvider {
addFontLoader(loader: IFontLoader):void;
}
3 changes: 3 additions & 0 deletions src/components/ImageCache/IImageProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
interface IImageProvider {
addImageLoader(loader: IImageLoader): void;
}
31 changes: 31 additions & 0 deletions src/components/ImageCache/ImageCache.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import React, { useEffect, useState } from "react";

export default function ImageCache({
imageProvider,
}: {
imageProvider: IImageProvider;
}) {
const [images, setImages] = useState<string[]>([]);

useEffect(() => {
imageProvider.addImageLoader({
addImage: (image) => {
setImages((oldImages) => {
return Array.from(new Set(oldImages).add(image));
});
},
});
}, [imageProvider]);

return (
<>
{images.map((image) => (
<img
key={image}
style={{ display: "none" }}
src={`${process.env.REACT_APP_FILE_API_ENDPOINT}/files/${image}`}
/>
))}
</>
);
}
40 changes: 0 additions & 40 deletions src/components/PaymentAlerts/PaymentAlerts.css

This file was deleted.

11 changes: 11 additions & 0 deletions src/components/PaymentAlerts/PaymentAlerts.module.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
.message {
width: 100%;
flex-grow: 0;
}

.paymentAlerts {
height: 100%;
display: flex;
flex-direction: column;
justify-content: flex-start;
}
Loading

0 comments on commit ab5a252

Please sign in to comment.