Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UI v3.0 Header + sim container layout tweaks #1996

Merged
merged 7 commits into from
Dec 1, 2022

Conversation

kayla-glick
Copy link
Contributor

@kayla-glick kayla-glick commented Dec 1, 2022

Restyling and reworking the header component to match the proposed v3 mock-ups.

Reference image

image

Screenshots

Desktop

image

image

Notice banner

image

Tablet

image

image

Mobile

image

image

@kayla-glick kayla-glick requested review from jimmyt857 and Kruhlmann and removed request for jimmyt857 December 1, 2022 16:41
@kayla-glick kayla-glick marked this pull request as ready for review December 1, 2022 16:41
@kayla-glick kayla-glick merged commit 1ed55cc into wowsims:master Dec 1, 2022
itemFragment.innerHTML = `
<li class="${showInRaidSim ? '' : 'within-raid-sim-hide'}">
<a
href="javascript:void(0)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we don't intend to use this element as an actual anchor (by having, what I assume to be, an empty link), would it make sense to replace it with a different type of DOM element?

Copy link
Contributor Author

@kayla-glick kayla-glick Dec 1, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For accessibility, interactive elements should always use either anchors or buttons (oh and also details elements exist in HTML 5). Since buttons get styled by default, anchors are usually the go-to


// Config for displaying a warning to the user whenever a condition is met.
interface SimWarning {
updateOn: TypedEvent<any>,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to annotate this listener? Alternatively We could:

interface SimWarning<UpdateListenerType> {
	updateOn: TypedEvent<UpdateListerType>,
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can try that, yeah. Again just a copy over

let downloadBinary = downloadFragment.children[0] as HTMLElement;

if (document.location.href.includes("localhost")) {
fetch(document.location.protocol + "//" + document.location.host + "/version").then(resp => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could this not be replaced with:

Suggested change
fetch(document.location.protocol + "//" + document.location.host + "/version").then(resp => {
fetch("/version").then(resp => {

image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably? I just copied this over from the old location. Didn't want to mess with it too much. I'll try it out

});
} else {
downloadBinary.setAttribute('data-bs-title', 'Download simulator for faster simulating')
new Tooltip(downloadBinary);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally don't feel too good about having a constructor with side-effects, but if that's how bootstrap does it, then we should just keep it IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah unfortunately Bootstrap does a pass when the page loads, but because everything is rendered in via JS we have to manually initialize like this.

}
}

private addSimOptionsLink() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These social link methods seem very similar. Could we abstract some of it away? Maybe into a separate class/classes as this one is getting fairly big.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I definitely could, similar to the addToolbarItem method

}
}

let headerFragment = document.createElement('fragment');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These global variables should probably be part of the class in some way, or moved to a separate class.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't seem to find a way to move this into the class. The way the components are set up isn't really conducive to it. You can't initialize it as a property outside the constructor, you can't make it a method because you can't use this before calling super (and you have to pass the element to super to use the root element)

declare var tippy: any;
declare var pako: any;

const URLMAXLEN = 2048;
const noticeText = '';
//const noticeText = 'We are looking for help migrating our sims to Wrath of the Lich King. If you\'d like to participate in a fun side project working with an open-source community please <a href="https://discord.gg/jJMPr9JWwx" target="_blank">join our discord!</a>';
// const noticeText = "We're looking for help migrating our sims to Wrath of the Lich King. If you\'d like to participate in a fun side project working with an open-source community, please <a href='https://discord.gg/jJMPr9JWwx' target='_blank'>join our Discord!</a>";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should delete this notice text "backup". If we want to retrieve it, it'll be available in the git history.

@kayla-glick kayla-glick deleted the ui-v3/header branch January 12, 2023 16:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants