Skip to content

Commit

Permalink
releasef custom text option
Browse files Browse the repository at this point in the history
  • Loading branch information
Sammers21 committed Mar 4, 2024
1 parent fb54bdf commit 981cdb8
Showing 1 changed file with 16 additions and 5 deletions.
21 changes: 16 additions & 5 deletions frontend/src/containers/Profile/ObsWidget.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ function getAlign(searchParams: URLSearchParams) {
return getSearchParamOrDefault(searchParams, "align", "center");
}

function getCustomText(searchParams: URLSearchParams) {
return getSearchParamOrDefault(searchParams, "customText", "");
}

export const ObsWidget = () => {
let { region, realm, name } = useParams();
const [searchParams, _] = useSearchParams();
Expand All @@ -51,6 +55,7 @@ export const ObsWidget = () => {
const nologo = getNoLogo(searchParams);
const limit = getLimit(searchParams);
const align = getAlign(searchParams);
const customText = getCustomText(searchParams);
useEffect(() => {
document.title = `OBS Widget - ${name}-${realm} on ${region?.toUpperCase()}`;
loadPlayerData();
Expand Down Expand Up @@ -98,7 +103,8 @@ export const ObsWidget = () => {
} else {
return true;
}
}).slice(0, limit);
})
.slice(0, limit);
let flex;
if (layout === "horizontal") {
flex = "flex-row";
Expand All @@ -108,13 +114,13 @@ export const ObsWidget = () => {
flex = "flex-col";
}
let contentList;
let alignCss = 'items-center'
let alignCss = "items-center";
if (align === "left") {
alignCss = 'items-start'
alignCss = "items-start";
} else if (align === "right") {
alignCss = 'items-end'
alignCss = "items-end";
} else {
alignCss = 'items-center'
alignCss = "items-center";
}
if (style === "simple-text") {
contentList = specAndMaxShuffle?.map((alt) => {
Expand Down Expand Up @@ -165,6 +171,11 @@ export const ObsWidget = () => {
<br />
</div>
) : null}
{customText === "" ? null : (
<div>
<Typography variant="h6">{customText}</Typography>
</div>
)}
{contentList}
</div>
</div>
Expand Down

0 comments on commit 981cdb8

Please sign in to comment.