Skip to content

Commit a2e3bd6

Browse files
authored
Merge pull request #55 from PoglyApp/0.2.0-hotfix
0.2.1-release
2 parents ecf7e8d + cac78bc commit a2e3bd6

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1469
-578
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ For assistance with setting up Pogly, we are available in our [Discord](https://
7979
<a href="https://www.twitch.tv/whataturtle" rel="noreferrer" target="_blank" title="whataturtle"><img src="./images/streamers/whataturtle.svg" /></a>
8080
<a href="https://www.twitch.tv/savix" rel="noreferrer" target="_blank" title="Savix"><img src="./images/streamers/savix.svg" /></a>
8181
<a href="https://www.twitch.tv/derkajohnstv" rel="noreferrer" target="_blank" title="DerkaJohnsTV"><img src="./images/streamers/derkajohnstv.svg" /></a>
82+
<a href="https://www.twitch.tv/pengwin" rel="noreferrer" target="_blank" title="Pengwin"><img src="./images/streamers/pengwin.svg" /></a>
8283

8384
## Contributing
8485

images/streamers/pengwin.svg

Lines changed: 13 additions & 0 deletions
Loading

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "pogly-standalone",
3-
"version": "0.2.0",
3+
"version": "0.2.1",
44
"private": true,
55
"dependencies": {
66
"@clockworklabs/spacetimedb-sdk": "^0.11.1",

server/Layouts/LayoutReducers.cs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ public static void AddLayoutWithId(ReducerContext ctx, uint id, string name, boo
6969
CreatedBy = guest.Nickname,
7070
Active = active
7171
};
72+
7273
newLayout.Insert();
7374

7475
//TODO: Add AutitLog() ChangeStruct types and methods for Layouts
@@ -81,6 +82,83 @@ public static void AddLayoutWithId(ReducerContext ctx, uint id, string name, boo
8182
}
8283
}
8384

85+
[SpacetimeDB.Reducer]
86+
public static void DuplicateLayout(ReducerContext ctx, uint layoutId)
87+
{
88+
string func = "DuplicateLayout";
89+
90+
if (ctx.Address is null) return;
91+
92+
try
93+
{
94+
if (!GetGuest(func, ctx.Address, out var guest))
95+
return;
96+
if (!GuestAuthenticated(func, guest)) return;
97+
if (Config.FindByVersion(0)!.Value.StrictMode)
98+
{
99+
if (!IsGuestModerator(func, ctx.Sender)) return;
100+
}
101+
102+
var layout = Layouts.FilterById(layoutId).First();
103+
104+
uint newLayoutId = 0;
105+
foreach (var i in Layouts.Iter())
106+
{
107+
if (i.Id > newLayoutId) newLayoutId = i.Id;
108+
}
109+
110+
var newLayout = new Layouts
111+
{
112+
Id = newLayoutId + 1,
113+
Name = layout.Name,
114+
CreatedBy = guest.Nickname,
115+
Active = false
116+
};
117+
118+
newLayout.Insert();
119+
120+
var elements = Elements.FilterByLayoutId(layoutId);
121+
122+
uint maxElementId = 0;
123+
foreach (var i in Elements.Iter())
124+
{
125+
if (i.Id > maxElementId) maxElementId = i.Id;
126+
}
127+
128+
uint newIndex = maxElementId + 1;
129+
130+
foreach (Elements element in elements)
131+
{
132+
var newElement = new Elements
133+
{
134+
Id = newIndex,
135+
Element = element.Element,
136+
Transparency = element.Transparency,
137+
Transform = element.Transform,
138+
Clip = element.Clip,
139+
Locked = false,
140+
LayoutId = newLayoutId + 1,
141+
FolderId = 0,
142+
PlacedBy = guest.Nickname,
143+
LastEditedBy = guest.Nickname,
144+
ZIndex = element.ZIndex
145+
};
146+
147+
newElement.Insert();
148+
149+
newIndex++;
150+
}
151+
152+
//TODO: Add AutitLog() ChangeStruct types and methods for Layouts
153+
if(Config.FindByVersion(0)!.Value.DebugMode)
154+
Log($"[Layouts - {func}] {guest.Nickname} duplicated layout {layout.Name}!");
155+
}
156+
catch (Exception e)
157+
{
158+
Log($"[{func}] Error duplicating Layout, requested by {ctx.Sender}! " + e.Message, LogLevel.Error);
159+
}
160+
}
161+
84162
[SpacetimeDB.Reducer]
85163
public static void ImportLayout(ReducerContext ctx, uint id, string name, string createdBy, bool active = false)
86164
{

src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ export const App: React.FC = () => {
159159
);
160160

161161
if (isWidget) {
162-
return (<RouterProvider router={router} />);
162+
return <RouterProvider router={router} />;
163163
}
164164

165165
// Step 1) Are connection settings configured?
@@ -277,7 +277,7 @@ export const App: React.FC = () => {
277277
}
278278

279279
// Step 4) If Authentication is required, are we Authenticated?
280-
if (spacetime.InstanceConfig.authentication) {
280+
if (!isOverlay && spacetime.InstanceConfig.authentication) {
281281
DebugLogger("Is guest authenticated");
282282
if (stdbAuthTimeout) {
283283
DebugLogger("Authentication required but authentication failed");

src/Components/Containers/ContextMenus/GuestListContextMenu.tsx

Lines changed: 56 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ export const GuestListContextMenu = (props: IProps) => {
2929
props.setContextMenu(null);
3030
};
3131

32+
if (!selectedGuest) return <></>;
33+
3234
return (
3335
<Menu
3436
open={props.contextMenu !== null}
@@ -43,66 +45,68 @@ export const GuestListContextMenu = (props: IProps) => {
4345
MenuListProps={{ onMouseLeave: handleClose }}
4446
sx={{ zIndex: 2000000 }}
4547
>
46-
{selectedGuest !== null && identityPermission ? (
47-
<div>
48-
<Paper variant="outlined" sx={{ fontWeight: "bold", color: "#ffffffa6", padding: "5px", margin: "5px" }}>
49-
{selectedGuest.nickname}
50-
</Paper>
51-
52-
<Paper variant="outlined" sx={{ color: "#ffffffa6", padding: "5px", margin: "5px" }}>
53-
{"Permission: "}
54-
{selectedGuestPermission?.tag === undefined ? "User" : selectedGuestPermission?.tag}
55-
</Paper>
56-
57-
{!selectedGuest.identity.isEqual(Identity.identity) && identityPermission.tag === "Owner" ? (
58-
<>
59-
{selectedGuestPermission?.tag === "Moderator" ? (
60-
<StyledMenuItemOrange
61-
onClick={() => {
62-
ClearIdentityPermissionReducer.call(selectedGuest.identity);
63-
handleClose();
64-
}}
65-
sx={{ color: "#008205" }}
66-
>
67-
Revoke Moderator
68-
</StyledMenuItemOrange>
69-
) : (
70-
<StyledMenuItemGreen
71-
onClick={() => {
72-
SetIdentityPermissionModeratorReducer.call(selectedGuest.identity);
73-
handleClose();
74-
}}
75-
>
76-
Grant Moderator
77-
</StyledMenuItemGreen>
78-
)}
79-
<StyledMenuItemRed
48+
<div>
49+
<Paper variant="outlined" sx={{ fontWeight: "bold", color: "#ffffffa6", padding: "5px", margin: "5px" }}>
50+
{selectedGuest.nickname}
51+
</Paper>
52+
53+
<Paper variant="outlined" sx={{ color: "#ffffffa6", padding: "5px", margin: "5px" }}>
54+
{"Permission: "}
55+
{selectedGuestPermission?.tag === undefined ? "User" : selectedGuestPermission?.tag}
56+
</Paper>
57+
58+
{!selectedGuest.identity.isEqual(Identity.identity) &&
59+
identityPermission &&
60+
identityPermission.tag === "Owner" ? (
61+
<>
62+
{selectedGuestPermission?.tag === "Moderator" ? (
63+
<StyledMenuItemOrange
8064
onClick={() => {
81-
KickGuestReducer.call(selectedGuest.address);
65+
ClearIdentityPermissionReducer.call(selectedGuest.identity);
8266
handleClose();
8367
}}
68+
sx={{ color: "#008205" }}
8469
>
85-
Kick Guest
86-
</StyledMenuItemRed>
87-
</>
88-
) : (
89-
<></>
90-
)}
91-
92-
{selectedGuest.identity.isEqual(Identity.identity) ? (<>
93-
<StyledMenuItemRed
70+
Revoke Moderator
71+
</StyledMenuItemOrange>
72+
) : (
73+
<StyledMenuItemGreen
9474
onClick={() => {
95-
KickSelfReducer.call();
75+
SetIdentityPermissionModeratorReducer.call(selectedGuest.identity);
9676
handleClose();
9777
}}
9878
>
99-
Kick Self
100-
</StyledMenuItemRed>
101-
</>) : (<></>)}
102-
</div>
103-
) : (
104-
""
105-
)}
79+
Grant Moderator
80+
</StyledMenuItemGreen>
81+
)}
82+
<StyledMenuItemRed
83+
onClick={() => {
84+
KickGuestReducer.call(selectedGuest.address);
85+
handleClose();
86+
}}
87+
>
88+
Kick Guest
89+
</StyledMenuItemRed>
90+
</>
91+
) : (
92+
<></>
93+
)}
94+
95+
{selectedGuest.identity.isEqual(Identity.identity) ? (
96+
<>
97+
<StyledMenuItemRed
98+
onClick={() => {
99+
KickSelfReducer.call();
100+
handleClose();
101+
}}
102+
>
103+
Kick Self
104+
</StyledMenuItemRed>
105+
</>
106+
) : (
107+
<></>
108+
)}
109+
</div>
106110
</Menu>
107111
);
108112
};

src/Components/ElementSelectionMenu/Categories/ChannelEmoteCategory.tsx

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { Accordion, AccordionDetails, AccordionSummary, Button, SvgIcon } from "
22
import ExpandMoreIcon from "@mui/icons-material/ExpandMore";
33
import { useContext, useEffect, useState } from "react";
44
import SevenTVEmote from "../../../Types/SevenTVTypes/SevenTVEmoteType";
5-
import { useSevenTV } from "../../../Hooks/useSevenTV";
65
import { insertElement } from "../../../StDB/Reducers/Insert/insertElement";
76
import ElementStruct from "../../../module_bindings/element_struct";
87
import ImageElementData from "../../../module_bindings/image_element_data";
@@ -11,29 +10,33 @@ import styled from "styled-components";
1110
import { StyledInput } from "../../StyledComponents/StyledInput";
1211
import AddCircleOutlineIcon from "@mui/icons-material/AddCircleOutline";
1312
import { LayoutContext } from "../../../Contexts/LayoutContext";
14-
import { useBetterTV } from "../../../Hooks/useBetterTV";
1513
import BetterTVEmote from "../../../Types/BetterTVTypes/BetterTVEmoteType";
1614
import BetterTVWrap from "../../../Utility/BetterTVWrap";
1715
import { SevenTVIcon, BetterTVIcon } from "../../../Utility/SVGIcons";
1816
import ChannelEmote from "../../../Types/General/ChannelEmoteType";
1917
import { DebugLogger } from "../../../Utility/DebugLogger";
2018

21-
export const ChannelEmoteCategory = () => {
22-
const layoutContext = useContext(LayoutContext);
19+
interface IProps {
20+
sevenTVEmotes: SevenTVEmote[] | undefined;
21+
betterTVEmotes: BetterTVEmote[] | undefined;
22+
}
2323

24-
const [sevenTVInitialized, setSevenTVInitialized] = useState<boolean>(false);
25-
const [betterTVInitialized, setBetterTVInitialized] = useState<boolean>(false);
24+
export const ChannelEmoteCategory = (props: IProps) => {
25+
const layoutContext = useContext(LayoutContext);
2626

27-
const [twitchId, setTwitchId] = useState<string>();
2827
const [sevenTVEmotes, setSevenTVEmotes] = useState<SevenTVEmote[]>([]);
2928
const [betterTVEmotes, setBetterTVEmotes] = useState<BetterTVEmote[]>([]);
3029
const [searchEmote, setSearchEmote] = useState<string>("");
3130

3231
const [shownEmotes, setShownEmotes] = useState<ChannelEmote[]>([]);
3332
const [maxDisplayed, setMaxDisplayed] = useState<number>(10);
3433

35-
useSevenTV(setSevenTVEmotes, setTwitchId, sevenTVInitialized, setSevenTVInitialized);
36-
useBetterTV(twitchId, setBetterTVEmotes, betterTVInitialized, setBetterTVInitialized);
34+
useEffect(() => {
35+
if(!props.sevenTVEmotes) return;
36+
if(!props.betterTVEmotes) return;
37+
setSevenTVEmotes(() => [...props.sevenTVEmotes!]);
38+
setBetterTVEmotes(() => [...props.betterTVEmotes!]);
39+
}, [props.sevenTVEmotes, props.betterTVEmotes]);
3740

3841
useEffect(() => {
3942
if (sevenTVEmotes.length < 1) return;

0 commit comments

Comments
 (0)