fix: settings popover not showing

- removed conflict of IDs
- removed home btn getting disabled
This commit is contained in:
Ayo Ayco 2023-08-23 22:32:31 +02:00
parent b357ee58c4
commit 9fd8eba7c5
2 changed files with 3 additions and 6 deletions

View file

@ -38,14 +38,14 @@ const { toggle } = Astro.props;
<small>This is where feature flags will be set once made available. <a href="https://github.com/ayoayco/cozy/issues/new" target="_blank">Request features or report bugs here.</a></small> <small>This is where feature flags will be set once made available. <a href="https://github.com/ayoayco/cozy/issues/new" target="_blank">Request features or report bugs here.</a></small>
</form> </form>
<Serialize id="settings-toggle" data={{toggle}} /> <Serialize id="settings-toggle-id" data={{toggle}} />
<script> <script>
/** /**
* temporary JS solution, should be replaced with CSS * temporary JS solution, should be replaced with CSS
*/ */
import { deserialize } from "@ayco/astro-resume"; import { deserialize } from "@ayco/astro-resume";
const {toggle} = deserialize("settings-toggle"); const {toggle} = deserialize("settings-toggle-id");
document document
.getElementById(toggle) .getElementById(toggle)
?.addEventListener("change", (e) => { ?.addEventListener("change", (e) => {

View file

@ -65,20 +65,17 @@ export function renderPost(responseText: string | null, url, postDivSelector: st
postDiv.innerHTML = postText; postDiv.innerHTML = postText;
const appUrl = document.getElementById('app-url') as HTMLInputElement; const appUrl = document.getElementById('app-url') as HTMLInputElement;
const homeBtn = document.querySelector<HTMLButtonElement>('#app-home');
const backBtn = document.querySelector<HTMLButtonElement>('#app-back'); const backBtn = document.querySelector<HTMLButtonElement>('#app-back');
const submitBtn = document.querySelector<HTMLButtonElement>('#submit'); const submitBtn = document.querySelector<HTMLButtonElement>('#submit');
if(cozyUrl !== '/') { if(cozyUrl !== '/') {
appUrl.value = cozyUrl || ''; appUrl.value = cozyUrl || '';
backBtn?.removeAttribute('disabled'); backBtn?.removeAttribute('disabled');
submitBtn?.removeAttribute('disabled'); submitBtn?.removeAttribute('disabled');
homeBtn?.removeAttribute('disabled');
document.title = cozyTitle; document.title = cozyTitle;
} else { } else {
appUrl.value = ''; appUrl.value = '';
backBtn?.setAttribute('disabled', 'true'); backBtn?.setAttribute('disabled', 'true');
submitBtn?.setAttribute('disabled', 'true'); submitBtn?.setAttribute('disabled', 'true');
homeBtn?.setAttribute('disabled', 'true');
document.title = `Cozy`; document.title = `Cozy`;
} }
@ -115,4 +112,4 @@ function getCozyTitle(html: HTMLHtmlElement): string | undefined {
?? html.querySelector("title")?.innerHTML ?? html.querySelector("title")?.innerHTML
?.replace("Cozy 🧸 | ", "") ?.replace("Cozy 🧸 | ", "")
} }