Skip to content

Commit

Permalink
Fix css
Browse files Browse the repository at this point in the history
Simplify ID of extra content
Fix page does not show up
  • Loading branch information
luc-github committed Jul 31, 2024
1 parent e3be6b0 commit cb4c371
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/areas/elementsCache.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ const ElementsCache = () => {
const [content, setContent] = useState([])

const extractValues = (entry) => {
const result = { id: "extra_content_EXTRAPANEL_" + entry.id };
const result = { id: "extra_content_" + entry.id };
entry.value.forEach(param => {
result[param.name] = param.value;
});
Expand All @@ -39,15 +39,15 @@ const ElementsCache = () => {

useEffect(() => {
if (ui.ready && interfaceSettings.current?.settings?.extracontents) {
console.log("ElementsCache can now be created")
//console.log("ElementsCache can now be created")

const extraContentSettings = interfaceSettings.current.settings.extracontents;
const extraContentsEntry = extraContentSettings.find(entry => entry.id === 'extracontents');

if (extraContentsEntry?.value?.length > 0) {
const newContent = extraContentsEntry.value.map(entry => {
const item = extractValues(entry)
console.log(item)
// console.log(item)
return <ExtraContentItem key={item.id} {...item} />
});
setContent(newContent);
Expand Down
2 changes: 1 addition & 1 deletion src/components/Controls/ContainerHelper.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { eventBus } from "../../hooks/eventBus"
const ContainerHelper = ({id, active=false}) => {

const [enabled, setEnabled] = useState(active)
console.log("ContainerHelper id", id ,"active", active)
//console.log("ContainerHelper id", id ,"active", active)
useEffect(() => {
const handleUpdateState = (msg) => {
if ('isFullScreen' in msg) {
Expand Down
13 changes: 7 additions & 6 deletions src/components/ExtraContent/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
const extra_content_id = `extra_content_${id}`
const target_id = `target_${id}`
const iconsList = { ...iconsTarget, ...iconsFeather }
console.log(id)
console.log(id)
const updateContentPosition = () => {
if (containerRef.current) {
const { top, left, width, height } = containerRef.current.getBoundingClientRect()
Expand All @@ -53,7 +53,7 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
updateContentPosition()
useEffect(() => {
if (!elementsCache.has(extra_content_id)) {
//console.log("Creating element " + extra_content_id," because it doesn't exist")
console.log("Creating element " + extra_content_id," because it doesn't exist")
elementsCache.create(extra_content_id, {
id,
source,
Expand All @@ -65,7 +65,7 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>
isVisible: true
})
} else {
//console.log("Updating element " + extra_content_id + " because it already exists")
console.log("Updating element " + extra_content_id + " because it already exists")
elementsCache.updateState(extra_content_id, { isVisible: true})
updateContentPosition()
}
Expand Down Expand Up @@ -136,7 +136,6 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>

<FullScreenButton
elementId={extra_content_id}
onclick={handleFullScreen}
asButton={true}
/>

Expand All @@ -145,8 +144,9 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>

if (target === "page") {
console.log("Rendering page element " + extra_content_id)
console.log("Page Id " + id)
return (
<div class = "page-container">
<div class = "page-container" id={id}>
<div id={target_id} ref={containerRef} class="page-target-container">
{/* content should fit this container */}
</div>
Expand All @@ -157,11 +157,12 @@ const ExtraContent = ({ id, source, refreshtime, label, type, target, icon }) =>

if (target === "panel") {
// console.log("Rendering panel element " + extra_content_id)
console.log("Panel Id " + id)
const displayIcon = iconsList[icon] || ""
return (
<Fragment>
<div class="panel panel-dashboard" id={id}>
<ContainerHelper id={id} />

<div class="navbar">
<span class="navbar-section feather-icon-container">
{displayIcon}
Expand Down
4 changes: 2 additions & 2 deletions src/pages/dashboard/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ const Dashboard = () => {
}, {})

if (item.target == "panel") {
acc.push(ExtraPanelElement(item, "EXTRAPANEL_" + curr.id))
acc.push(ExtraPanelElement(item, curr.id))
}
return acc
}, [])
Expand All @@ -293,7 +293,7 @@ const Dashboard = () => {
<span
class="dropdown-toggle btn tooltip tooltip-right m-1"
tabindex="0"
style="z-index: 10000"
style="z-index: 1000"
data-tooltip={T("S187")}
onclick={() => {
useUiContextFn.haptic()
Expand Down
1 change: 1 addition & 0 deletions src/style/components/_menu.scss
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
.information-container {
flex: 0 1 auto;
z-index: 10000;
border: 0px !important;
}

.menu-item-panel{
Expand Down

0 comments on commit cb4c371

Please sign in to comment.