Skip to content

Commit

Permalink
v0.0.1-alpha.5
Browse files Browse the repository at this point in the history
Added tooltip UI which shows the status of each Mojang service.
Updated dependencies.
  • Loading branch information
dscalzi committed May 17, 2018
1 parent f5f5b72 commit ba916aa
Show file tree
Hide file tree
Showing 6 changed files with 175 additions and 39 deletions.
95 changes: 95 additions & 0 deletions app/assets/css/launcher.css
Original file line number Diff line number Diff line change
Expand Up @@ -1495,13 +1495,108 @@ p {
margin-left: 10px;
}

/* Wrapper container for the mojang status bar. */
#mojangStatusWrapper {
position: relative;
display: flex;
cursor: pointer;
}

/* Icon which displays the status of the mojang services. */
#mojang_status_icon {
font-size: 30px;
color: #848484;
margin-left: 15px;
}

/* Tooltip which displays more details about the mojang statuses. */
#mojangStatusTooltip {
position: absolute;
visibility: hidden;
opacity: 0;
width: 145px;
min-height: 150px;
background-color: rgba(0, 0, 0, 0.75);
color: #fff;
border-radius: 4px;
padding: 5px 10px;
z-index: 1;
font-family: 'Avenir Medium';
font-size: 12px;
transition: visibility 0s linear 0.25s, opacity 0.25s ease;
bottom: calc(100% + 15px);
transform: translateX(-50%);
margin-left: 50%;
box-shadow: 0px 0px 20px rgb(0, 0, 0);
cursor: default;
}
#mojangStatusTooltip:after {
content: " ";
position: absolute;
left: 50%;
top: 100%;
margin-left: -5px;
border-width: 5px;
border-style: solid;
border-color: rgba(0, 0, 0, 0.75) transparent transparent transparent;
}
#mojangStatusWrapper:hover #mojangStatusTooltip {
visibility: visible;
opacity: 1;
transition-delay: 0s;
}

/* Tooltip title for the mojang statuses. */
#mojangStatusTooltipTitle {
width: 100%;
text-align: center;
margin-bottom: 5px;
letter-spacing: 1px;
}

/* Wrapper container for the non essential services title. */
#mojangStatusNEContainer {
display: flex;
align-items: center;
margin: 10px 0px;
}

/* White bar which surrounds the non essential service title. */
.mojangStatusNEBar {
height: 1px;
width: 100%;
background: white;
}

/* Non essential service title text. */
#mojangStatusNETitle {
font-size: 10px;
padding: 0px 3px;
text-align: center;
letter-spacing: 1px;
}

/* Wrapper container for mojang service information. */
.mojangStatusContainer {
display: flex;
}

/* Displays the name of the mojang service. */
.mojangStatusName {
width: 100%;
font-size: 10px;
letter-spacing: 1px;
line-height: 12px;
padding: 6px 0px;
}

/* Displays the status of the mojang service. */
.mojangStatusIcon {
margin-right: 10px;
font-size: 18.5px;
color: #848484;
}

/* * *
* Landing View (Bottom Styles) | Center Content
* * */
Expand Down
26 changes: 16 additions & 10 deletions app/assets/js/mojang.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,34 +16,40 @@ const minecraftAgent = {
const authpath = 'https://authserver.mojang.com'
const statuses = [
{
service: 'minecraft.net',
service: 'sessionserver.mojang.com',
status: 'grey',
name: 'Minecraft.net'
name: 'Multiplayer Session Service',
essential: true
},
{
service: 'api.mojang.com',
service: 'authserver.mojang.com',
status: 'grey',
name: 'Public API'
name: 'Authentication Service',
essential: true
},
{
service: 'textures.minecraft.net',
status: 'grey',
name: 'Minecraft Skins'
name: 'Minecraft Skins',
essential: false
},
{
service: 'authserver.mojang.com',
service: 'api.mojang.com',
status: 'grey',
name: 'Authentication Service'
name: 'Public API',
essential: false
},
{
service: 'sessionserver.mojang.com',
service: 'minecraft.net',
status: 'grey',
name: 'Multiplayer Session Service'
name: 'Minecraft.net',
essential: false
},
{
service: 'account.mojang.com',
status: 'grey',
name: 'Mojang accounts website'
name: 'Mojang Accounts Website',
essential: false
}
]

Expand Down
29 changes: 27 additions & 2 deletions app/assets/js/scripts/landing.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,27 +141,52 @@ server_selection_button.addEventListener('click', (e) => {
// Update Mojang Status Color
const refreshMojangStatuses = async function(){
console.log('Refreshing Mojang Statuses..')

let status = 'grey'
let tooltipEssentialHTML = ``
let tooltipNonEssentialHTML = ``

try {
const statuses = await Mojang.status()
greenCount = 0

for(let i=0; i<statuses.length; i++){
if(statuses[i].status === 'yellow' && status !== 'red'){
const service = statuses[i]

if(service.essential){
tooltipEssentialHTML += `<div class="mojangStatusContainer">
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">&#8226;</span>
<span class="mojangStatusName">${service.name}</span>
</div>`
} else {
tooltipNonEssentialHTML += `<div class="mojangStatusContainer">
<span class="mojangStatusIcon" style="color: ${Mojang.statusToHex(service.status)};">&#8226;</span>
<span class="mojangStatusName">${service.name}</span>
</div>`
}

if(service.status === 'yellow' && status !== 'red'){
status = 'yellow'
continue
} else if(statuses[i].status === 'red'){
} else if(service.status === 'red'){
status = 'red'
break
}

++greenCount
}

if(greenCount == statuses.length){
status = 'green'
}

} catch (err) {
console.warn('Unable to refresh Mojang service status.')
console.debug(err)
}

document.getElementById('mojangStatusEssentialContainer').innerHTML = tooltipEssentialHTML
document.getElementById('mojangStatusNonEssentialContainer').innerHTML = tooltipNonEssentialHTML
document.getElementById('mojang_status_icon').style.color = Mojang.statusToHex(status)
}

Expand Down
20 changes: 18 additions & 2 deletions app/landing.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,24 @@
<span id="player_count">OFFLINE</span>
</div>
<div class="bot_divider"></div>
<span class="bot_label">MOJANG STATUS</span>
<span id="mojang_status_icon">&#8226;</span>
<div id="mojangStatusWrapper">
<span class="bot_label">MOJANG STATUS</span>
<span id="mojang_status_icon">&#8226;</span>
<div id="mojangStatusTooltip">
<div id="mojangStatusTooltipTitle">Services</div>
<div id="mojangStatusEssentialContainer">
<!-- Essential Mojang services are populated here. -->
</div>
<div id="mojangStatusNEContainer">
<div class="mojangStatusNEBar"></div>
<div id="mojangStatusNETitle">Non&nbsp;Essential</div>
<div class="mojangStatusNEBar"></div>
</div>
<div id="mojangStatusNonEssentialContainer">
<!-- Non Essential Mojang services are populated here. -->
</div>
</div>
</div>
</div>
</div>
</div>
Expand Down
38 changes: 16 additions & 22 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "westeroscraftlauncher",
"version": "0.0.1-alpha.4",
"version": "0.0.1-alpha.5",
"description": "Custom modded launcher for Westeroscraft",
"productName": "WesterosCraft Launcher",
"main": "index.js",
Expand Down Expand Up @@ -37,14 +37,14 @@
"electron-updater": "^2.21.10",
"jquery": "^3.3.1",
"mkdirp": "^0.5.1",
"request": "^2.85.0",
"request": "^2.86.0",
"rimraf": "^2.6.2",
"tar-fs": "^1.16.2",
"uuid": "^3.2.1",
"winreg": "^1.2.4"
},
"devDependencies": {
"electron": "^2.0.0",
"electron": "^2.0.1",
"electron-builder": "^20.13.5"
},
"build": {
Expand Down

0 comments on commit ba916aa

Please sign in to comment.