uaktags / explorer

An open source block explorer
BSD 3-Clause "New" or "Revised" License
6 stars 8 forks source link

Mobile view #16

Open spy0012 opened 5 years ago

spy0012 commented 5 years ago

Just a cosmetic based on mobile view

B43FE273-0D77-403B-986A-5C0DFEEC6B8C This happens on the above and coin supply on mobile/laptop easy fix?

Also If you can point me in the right direction, how do I make the menu bigger in mobile view assuming it’s all css

uaktags commented 5 years ago

Alot of that is going to come down to editing the layout.pug rather than editing the actual stylesheet. Basically would have to just figure out the correct attributes to use from Bootstrap or anything specifically added by Bootswatch.

For the Difficulty, you can add a "toFixed" to it to make it go to less decimal places. Specifically something like changing line 176 in layout.pug to

label#difficulty.toFixed(settings.decimal_places) -

Should do the trick. By default, I believe I have the decimal_places in the settings.json set to 8. However, I don't know how to do that via css (or if there's a way). We'd basically need a way for pug/javascript to detect the css and know that it's mobile, and then fluidly change the number. I don't have many ideas for this one.

spy0012 commented 5 years ago

Thanks, i will take a look, I have decimal places set at 4 but that image isn't 4

Been playing with the bootstrap column sizes - changed .col-md-2 -->>> .col-xs-2

Fixes the text out of box issue but looks awful lol image Looks like that even on desktop so i think i need to fix the decimal place issue as being set to 4 should not look like that. same as supply even though never saw an option for that.

uaktags commented 5 years ago

Did you make the above update to line 176? Currently, as it stands on the active branch, its not using the decimal_places setting, so that's why I'm suggesting it.

spy0012 commented 5 years ago

With that setting it's still the same as above 12 digits after the .

uaktags commented 5 years ago

Alright, try this pull.

spy0012 commented 5 years ago

That works brilliantly i think i will add another option for supply as that one makes the mobile card go out of shape compared to the others, but it works based n the setting in the json.

I have added a separate setting for supply which is 0 decimal places, will play with that, the only thing i have a problem pulling is from the coininfo issue other than that thanks already a lot better than the original :)

uaktags commented 5 years ago

Yea, I may go down this path: https://www.w3schools.com/jsref/met_win_matchmedia.asp Basically setup some functions for matchMedia to check against what width we're at (mobile/tablet/pc). Maybe not as diverse as Bootstrap's media-queries, but something to give us some wiggle room. We already can hide things via css like xs-none, but having a way to manipulate the data just isnt' there (it's not the job of CSS to manage data), so getting some js to help will go a long way I think.

spy0012 commented 5 years ago

Having JS in the mix will 100% help with achieving what is needed for mobile responsiveness and manipulation. I am limited to php and mysql and some JS, bootstrap i am still learning but a lot better for CSS

ElpidioMC commented 5 years ago

Alright, try this pull.

that pull causes error in hybrid currencies, does not show the value for PoW mining.

uaktags commented 5 years ago

What's the error? @ElpidioMC

The commit only affects the supply to add a toFixed and the "difficulty" but doesn't touch the Hybrid, so in theory the Hybrid stat should be the same as it's always been. But, then again, I don't know the error so we could be talking about two different things.

ElpidioMC commented 5 years ago

Yes @uaktags , in theory it should not affect, but with your change the difficulty in PoW mining was not shown, it is shown as "NaN", I had to revert your change and then if both difficulties were shown.

that is, I had to change the line:

- 39 $("#difficulty").text(Number(json.data[0].difficulty).toFixed(Number('#{settings.decimal_places}')));
+ 39 $("#difficulty").text(json.data[0].difficulty);
uaktags commented 5 years ago

@ElpidioMC

            $("#difficulty").text(Number(json.data[0].difficulty).toFixed(Number('#{settings.decimal_places}')));
            $("#difficultyHybrid").text(json.data[0].difficultyHybrid);
            console.log(typeof json.data[0].difficulty);
            console.log(json.data[0].difficulty);
            console.log(Number(json.data[0].difficulty));

Within your Browser's Console (F12 and then Console, or Right Click, Inspect element, and then console). please let me know what the 3 lines say.

I'm expecting an output like:

string                              127.0.0.1:3001:15:7
1290474.79666858                    127.0.0.1:3001:16:7
1290474.79666858                    127.0.0.1:3001:17:7

The assumption is that json.data[0].difficulty is a string of numbers and a single period. If there's no other text, it should then be able to be converted into an floating number with the Number function.