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>
</form>
<Serialize id="settings-toggle" data={{toggle}} />
<Serialize id="settings-toggle-id" data={{toggle}} />
<script>
/**
* temporary JS solution, should be replaced with CSS
*/
import { deserialize } from "@ayco/astro-resume";
const {toggle} = deserialize("settings-toggle");
const {toggle} = deserialize("settings-toggle-id");
document
.getElementById(toggle)
?.addEventListener("change", (e) => {

View file

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