Actifit Landingpage and Wallet View
Repository
https://github.com/mcfarhat/actifit-landingpage
I created this repository and then transferred ownership to mcfarhat. That's why there are no PRs but you can see me as the only contributor. For future updates there will be PRs.
Read about the project:
Landingpage and Wallet
The project was in need of a first little landingpage and a way for people to see their current funds.
Since this includes some data fetching and logic, I decided to use Vue.js and Nuxt.js again, to have a solid framework to work with.
The layout is completely custom, no templates were used, just bare Bootstrap 4.
The images come from pixabay.com and are free and require no attribution. But anyway, here are the sources:
https://pixabay.com/en/adult-body-casual-close-up-1867757/
https://pixabay.com/en/people-man-guy-running-sport-2590796/
https://pixabay.com/en/home-fitness-equipment-1840858/
Since the user wallet was the driving purpose of this page, there's a prominently placed box in the header, where you can enter a username and then see the account balance and transaction history. There's no login or other validation. You can type in any username and see it's balance and history.
By the way,... there are no features such as sending and receiving funds. It is really just pure information.
The main page contains only a little bit of text and some images, that I tried to arrange nicely. The only dynamic part is those two numbers - Tokens Distributed and Token Holders.
Implementation
I started with the wallet view, since this was the main task.
First step was to install a fresh Nuxt.js app. You can do this easily with the npx installer for Nuxt.
npx create-nuxt-app actifit-landingpage
This results in this first commit: https://github.com/mcfarhat/actifit-landingpage/commit/863d551e7ca75e90da4f27e949652728c957f9c3
The second commit actually already implements the wallet view functionality:
https://github.com/mcfarhat/actifit-landingpage/commit/f3d3624442c1b7fb102ad735fb27279db1daf235
There are two views, one for the homepage, which contains a form to provide the username and later became the actual landingpage, and the wallet page to view your account balance and transaction history.
On click on the "Show Wallet" button or by hitting enter in the input field, the goToWallet method is triggered, and sends you to /wallet/<username> if the provided username is at least 3 characters long.
https://github.com/mcfarhat/actifit-landingpage/blob/master/pages/index.vue#L136
The wallet page then just fetches the data from the API that the project already provides, and displays it.
https://github.com/mcfarhat/actifit-landingpage/blob/master/pages/wallet/_username.vue#L55
Regarding the rest of the landingpage, well... I don't really know what to write about it. It's plain and simple HTML/CSS. Nothing that needs any explanation, I guess. I can only say that all the commits after the first two, are only related to the looks of the website and displaying the content nicely.
Oh and of course it's mobile optimized:
Final Result:
actifit.io
actifit.io
This is just the first iteration, the minimum that was required. I'm already talking with @mcfarhat about future updates, so don't see this as a finished project. I guess it's far from that but it's a start.
this.transactions = json ? json : this.transactions, can you explain?Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.
To view those questions and the relevant answers related to your post, click here.
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]
Exactly... although, this is more a workaround. The default value for
this.transactionsis an empty array. Unfortunately this API endpoint returns a200 OKresponse even though it returns invalid JSON for some reason. This is why I had to add this check there. It makes sure thatthis.transactionsis still an empty array in case of an invalid response.Nice project! I would do it like this though:
this.transactions = json || this.transactionsIndeed... much prettier! :)
It looked like code poetry with its symmetry. And it gave me an idea! 💡
Thank you for the fantastic work so far @mkt ! :)
This is awesome. It will let users see their tokens at a glance and ultimately increase the userbase
Hey @mkt
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!
Want to chat? Join us on Discord https://discord.gg/h52nFrV.
Vote for Utopian Witness!