Skip to content

Commit d2d3833

Browse files
authored
Update styling with new nav (#49)
1 parent 7c326c1 commit d2d3833

File tree

17 files changed

+398
-372
lines changed

17 files changed

+398
-372
lines changed

index.html

Lines changed: 1 addition & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
<link href="/assets/mana.min.css" rel="stylesheet" type="text/css" />
2929
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/themes/dark.css" />
3030
<script type="module" src="https://cdn.jsdelivr.net/npm/@shoelace-style/[email protected]/cdn/shoelace-autoloader.js"></script>
31+
3132
<style>
3233
/* Hide the message by default */
3334
.safari-ios-message {
@@ -58,7 +59,6 @@
5859
button below, then select "Add to Home Screen".
5960
<span class="result"></span>
6061
</p>
61-
<sl-button variant="primary" id="share-sheet">Share</sl-button>
6262
</sl-card>
6363
<br /><br />
6464
<sl-card>
@@ -104,48 +104,6 @@
104104
window.localStorage.clear();
105105
alert("Browser cache and local storage has been cleared.");
106106
});
107-
108-
// Check if the Web Share API is supported
109-
if (navigator.share) {
110-
// Only create the shareData object if the Web Share API is supported
111-
const shareData = {
112-
title: "Moonsilver Waypoints",
113-
text: "Check out this great app for tracking Magic: The Gathering games!",
114-
url: "https://www.adamjolicoeur.me/",
115-
};
116-
117-
// Get the share button and the result paragraph
118-
const shareButton = document.getElementById("share-sheet");
119-
const resultPara = document.querySelector(".result");
120-
121-
// If the button or paragraph is missing, log an error and return early
122-
if (!shareButton || !resultPara) {
123-
console.error("Error: Share button or result paragraph not found in the DOM.");
124-
}
125-
126-
// Add a click event listener to the share button
127-
shareButton.addEventListener("click", async () => {
128-
try {
129-
// Attempt to use the Web Share API
130-
await navigator.share(shareData);
131-
132-
// If sharing is successful, update the result paragraph
133-
resultPara.textContent = "Shared successfully!";
134-
} catch (err) {
135-
// If an error occurs during sharing, update the result paragraph with the error
136-
if (err.name === "AbortError") {
137-
resultPara.textContent = "Sharing was canceled.";
138-
} else {
139-
resultPara.textContent = `Error: ${err}`;
140-
}
141-
console.error("Sharing failed:", err); // Log the error to the console
142-
}
143-
});
144-
} else {
145-
// If navigator.share is not supported, log a message to the console and hide the "Share" button
146-
console.warn("Web Share API not supported in this browser.");
147-
document.getElementById("share-sheet").classList.add("hide");
148-
}
149107
</script>
150108
</body>
151109

public/assets/scripts/share.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(function () {
2+
'use strict';
3+
//Check if share API is supported or not
4+
if (navigator.share !== undefined) {
5+
document.addEventListener('DOMContentLoaded', function() {
6+
var shareBtn = document.querySelector('.share');
7+
//Share button event listener
8+
shareBtn.addEventListener('click', function(event) {
9+
//Web share API
10+
navigator.share({
11+
title: "Moonsilver Waypoints",
12+
text: "Check out this great app for tracking Magic: The Gathering games!",
13+
url: "https://www.adamjolicoeur.me/"
14+
})
15+
.then(function() {
16+
console.info('Shared successfully.');
17+
})
18+
.catch(function (error) {
19+
console.error('Error in sharing: ', error);
20+
})
21+
});
22+
});
23+
}
24+
})();

src/components/game-tracker/standings-tracker.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -266,20 +266,18 @@ export class StandingsTracker extends LitElement {
266266

267267
return html `
268268
<div class="page-header">
269-
<sl-button-group label="game actions">
270-
<sl-button variant="success" size="small" pill label="export standings" @click=${this.exportStandings}>
271-
<sl-icon slot="prefix" library="default" name="file-earmark-excel-fill" label="Export Standings"></sl-icon>
272-
Export <span class="hide-at-800">Standings</span>
269+
<h1>Tournament Tracker</h1>
270+
<div class="button-group" label="game-actions">
271+
<sl-button variant="success" size="medium" circle label="export standings" @click=${this.exportStandings}>
272+
<sl-icon library="default" name="file-earmark-excel-fill" label="Export Standings"></sl-icon>
273273
</sl-button>
274-
<sl-button variant="warning" size="small" pill label="action to clear standings" @click=${this.clearStandingsConfirmed}>
275-
<sl-icon slot="prefix" library="default" name="trash-fill" label="Clear Standings"></sl-icon>
276-
<span class="hide-at-800">Clear</span> Standings
274+
<sl-button variant="warning" size="medium" circle label="action to clear standings" @click=${this.clearStandingsConfirmed}>
275+
<sl-icon library="default" name="trash-fill" label="Clear Standings"></sl-icon>
277276
</sl-button>
278-
<sl-button variant="danger" size="small" pill label="launch a modal to confirm clearing of match data" @click=${this.openConfirmationModal}>
279-
<sl-icon slot="prefix" library="default" name="trash-fill" label="Clear All Data"></sl-icon>
280-
<span class="hide-at-800">Clear All</span> Data
277+
<sl-button variant="danger" size="medium" circle label="launch a modal to confirm clearing of match data" @click=${this.openConfirmationModal}>
278+
<sl-icon library="default" name="trash-fill" label="Clear All Data"></sl-icon>
281279
</sl-button>
282-
</sl-button-group>
280+
</div>
283281
</div>
284282
<div style="display: flex; flex-direction: column; grid-gap: 1rem;">
285283
<sl-details summary="Match Results" open>
@@ -319,7 +317,7 @@ export class StandingsTracker extends LitElement {
319317
<edit-modal .match=${this.editMatchIndex !== null ? this.matchHistory[this.editMatchIndex] : null} .isOpen=${this.editModalOpen} @match-edited=${(e: CustomEvent) => this.editMatch(e.detail)} @close=${() => this.editModalOpen = false}></edit-modal>
320318
<confirmation-modal
321319
.isOpen=${this.confirmationModalOpen}
322-
message="Are you sure you want to clear the match data? This will also clear all related information."
320+
message="Are you sure you want to clear the match data? Standings and History will be deleted. Players must be removed individually."
323321
@confirm=${this.clearMatchResultsConfirmed}
324322
@close=${this.closeConfirmationModal}
325323
></confirmation-modal>

src/components/header.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ export class AppHeader extends LitElement {
6363
${document.title}
6464
</div>
6565
<sl-button-group label="Navigation" style="margin-right: 1rem;">
66-
6766
${this.enableBack ? html`
6867
<sl-button variant="default" size="small" pill aria-label="Back to start" label="Back to start" href="${resolveRouterPath()}">
6968
<sl-icon slot="prefix" name="house"></sl-icon>

0 commit comments

Comments
 (0)