Skip to content

Commit

Permalink
fix(overlays): add transformation of css
Browse files Browse the repository at this point in the history
  • Loading branch information
Satont committed Sep 18, 2023
1 parent 231af70 commit 29ce3db
Show file tree
Hide file tree
Showing 3 changed files with 101 additions and 27 deletions.
1 change: 1 addition & 0 deletions frontend/overlays/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
"dependencies": {
"@protobuf-ts/twirp-transport": "^2.9.1",
"@twir/grpc": "workspace:^",
"nested-css-to-flat": "^1.0.5",
"obs-websocket-js": "^5.0.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
Expand Down
6 changes: 4 additions & 2 deletions frontend/overlays/src/pages/overlaysRegistry.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { transform } from 'nested-css-to-flat';
import { Fragment, useCallback, useEffect, useRef, useState } from 'react';
import { useParams } from 'react-router-dom';
import useWebSocket from 'react-use-websocket';


declare global {
interface Window {
webkitAudioContext: typeof AudioContext
Expand Down Expand Up @@ -133,9 +135,9 @@ export const OverlaysRegistry: React.FC = () => {
{layers.filter(l => l.type === 'HTML').map((layer) => {
return <Fragment key={layer.id}>
<style>
{`.layer-${layer.id} {
{transform(`.layer-${layer.id} {
${b64DecodeUnicode(layer.settings.htmlOverlayCss)}
}`}
}`)}
</style>
<div
key={layer.id}
Expand Down
121 changes: 96 additions & 25 deletions pnpm-lock.yaml

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

0 comments on commit 29ce3db

Please sign in to comment.