Giter Site home page Giter Site logo

citycoins / ui Goto Github PK

View Code? Open in Web Editor NEW

This project forked from friedger/stacks-send-many

28.0 28.0 13.0 3.83 MB

Basic UI components for interacting with the CityCoin contract. Requires Stacks Wallet for Web.

Home Page: https://minecitycoins.com

License: GNU General Public License v3.0

HTML 1.59% JavaScript 92.41% CSS 5.99%

ui's People

Contributors

abdullahranginwala avatar brianhhough avatar diopitis avatar friedger avatar lnow avatar omurcataltepe avatar phershbe avatar randr000 avatar vidiabtc avatar whoabuddy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

ui's Issues

🐞[BUG] claim-stacking-reward fails due to post conditions

Describe the bug

When trying to claim tokens at a specific block height through the function claim-stacking-reward in the contract, the transaction succeeds but then is rolled back by a post-condition.

Example TX linked here

To Reproduce

Steps to reproduce the behavior:

  1. Go to https://testnet.minemiamicoin.com
  2. Mine some CityCoins
  3. Claim some CityCoins
  4. Stack some CityCoins
  5. Claim the stacking reward

Expected behavior

Both STX and CityCoins should have transferred to my wallet.

Additional Context

Relevant contract code below:

(define-public (claim-stacking-reward (target-reward-cycle uint))
  (let (
    (stacker tx-sender)  
    (entitled-ustx (get-entitled-stacking-reward tx-sender target-reward-cycle block-height))
    (stacked-in-cycle (get-stacked-in-cycle tx-sender target-reward-cycle))
  )
  (begin
    (asserts! (> entitled-ustx u0)
      (err ERR-NOTHING-TO-REDEEM))
    (map-set stacked-per-cycle
      { stacker: tx-sender, reward-cycle: target-reward-cycle }
      { amount-token: u0 })
    (try! (as-contract (stx-transfer? entitled-ustx tx-sender stacker)))
    (try! (as-contract (ft-transfer? citycoins stacked-in-cycle tx-sender stacker)))
    (ok true)
  ))
)

Noting that there are some differences in the token code between the version deployed to testnet and the most recent code in the citycoins repo.

Add Stacking resources to UI

Make it easy for users to get from $MIA --> $STX --> $BTC by providing basic instructions and resources about Stacking STX.

🐞[BUG] stacking claims inaccuracies

Describe the bug

The way we compute and show the stacking claims now, there are two issues:

  • it doesn't indicate if a cycle is active (would result in failed claim)
  • it doesn't account for tokens being stacked over multiple cycles

To Reproduce

Steps to reproduce the behavior:

  1. Stack for more than one reward cycle
  2. View the stacking claim tab

Expected behavior

The card to claim the tokens should only show for the last reward cycle tokens are stacked for, e.g.

  • stacked in cycle 35 for 3 cycles, only shows a card for cycle 38
  • stacked in cycle 35 for 30 cycles, only shows a card for cycle 65

The claim button should be disabled if the reward cycle is active, and we could add a badge or some sort of "in progress" notification.

Screenshots

Screenshot from 2021-06-23 16-27-02-edited

Screenshot from 2021-06-23 16-54-26

note that alternate layout above is from #54

Cannot read property 'appPrivateKey' of null

Error after logout, probably related to small profile implementation in header next to nav, need to dig further.

Unhandled Rejection (TypeError): Cannot read property 'appPrivateKey' of null
(anonymous function)
src/lib/hooks.js:14
  11 | useEffect(() => {
  12 |   if (userSession) {
  13 |     getUserData(userSession).then(userData => {
> 14 |       const { address } = getStacksAccount(userData.appPrivateKey);
     | ^  15 |       setAppStxAddress(addressToString(address));
  16 |       setOwnerStxAddress(userData.profile.stxAddress[testnet || mocknet ? 'testnet' : 'mainnet']);
  17 |     });

⚑[FEAT]

Is your feature request related to a problem? Please describe.
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

Describe the solution you'd like
A clear and concise description of what you want to happen.

Describe alternatives you've considered
A clear and concise description of any alternative solutions or features you've considered.

Additional context
Add any other context or screenshots about the feature request here.

🐞[BUG] View address on explorer results in 404

Describe the bug
Can't 'View address on explorer' after logging in to 'https://minecitycoins.com'

To Reproduce
Steps to reproduce the behavior:

  1. Go to 'https://minecitycoins.com/'
  2. Click on 'Profile'
  3. Click on 'Actions'
  4. Click on 'View address on explorer'
  5. Get error 'This address doesn't seem correct. This page isn't available, and it looks like the address provided isn't correct.'

Expected behavior
View my address in explorer

Screenshots
image

Desktop (please complete the following information):

  • OS: Windows
  • Browser [chrome]
  • Version [e.g. 22]

Additional context
Tried this after logging in with wallet SP2T04RQY3SP5V24233ABVX9G5CV14NMSB1ZF83NQ

Sometimes, instead of the word 'profile', it has part of my address, but most of the time it just says 'profile', am I really logged in?
image

Update favicon

The main website uses the citycoin blue logo reversed, we should match that.

Mining Claim: pending rewards should not be displayed

Under claim mining rewards I saw that I won a block (or at least I think I did?):

image

I then tried claiming it using the displayed block height, tx confirmed here:

https://explorer.stacks.co/txid/0x51ed3566dce576fe56c02a6709a90e47e3003442266f5fff53681ac0277983c1?chain=testnet

After refreshing now I see the same message and it's not easy to tell if I should claim for that height again or not.

If we could update it to be a button per claim like the screenshot below, it would prevent users from having to enter the block number, and also make it easier to see if a reward was claimed or not.

Screenshot_from_2021-06-03_21-09-06

Error in Get Started when wallet is not enabled

When I press the "Get Started" button, I get the following error if my extension is disabled:

TypeError: Object(...) is not a function
showConnect
http://localhost:3000/static/js/vendors~main.chunk.js:21716:82
handleOpenAuth
src/lib/auth.js:35
  32 | };
  33 | 
  34 | const handleOpenAuth = () => {
> 35 |   showConnect(authOptions);
     | ^  36 | };
  37 | 
  38 | const handleSignOut = useCallback(() => {

Need to test if this is the same for if someone doesn't have the extension installed, and handle the error appropriately.

🐞[BUG] error when logged in and page left open

When leaving the page open with mining/stacking instructions, this error eventually pops up:

Unhandled Rejection (TypeError): Cannot read property 'data' of undefined
getWinningDetailsFor
src/lib/citycoin.js:155
  152 | const minerOfBlockCV = hexToCV(minerOfBlock.data);
  153 | console.log({ minerOfBlockCV: cvToString(minerOfBlockCV) });
  154 | // add commit to total
> 155 | const nextSum = sum + minerOfBlockCV.value.data.ustx.value.toNumber();
      | ^  156 | // check total for winning amount
  157 | if (sum <= winningAmount && nextSum > winningAmount) {
  158 |   winner = minerOfBlockCV;
View compiled
async getMiningDetails
src/lib/citycoin.js:105
  102 | for (let tx of txs) {
  103 |   if (tx.contract_call.function_name === 'mine-tokens-over-30-blocks') {
  104 |     for (let i = 29; i >= 0; i--) {
> 105 |       winningDetails.push(await getWinningDetailsFor(tx.block_height + i, minerId));
      | ^  106 |     }
  107 |   } else {
  108 |     winningDetails.push(await getWinningDetailsFor(tx.block_height, minerId));

Show total spend when mine 30 blocks checked

It should be easier to see what you are going to spend when checking this box, which is basically 30x the amount specified.

In the confirmation window values were displayed in STX, and it's a bit confusing, e.g.

Bidding 10 uSTX = 0.00001 STX
Total Bid = 0.0003 STX

Add memo input functionality to mining page

I added an input for memo, but it's not connected to the underlying functions so its disabled for now.

Miners can submit an (optional) memo with each transaction, and we should enable that!

Screenshot from 2021-06-21 10-56-07

⚑[FEAT] show relevant TX type per tab

Each tab could show the relevant transactions, making it easier to understand what's been done in each context.

  • register component would show register-miner
  • mining tab would show mine-blocks and mine-over-30-blocks
  • mining claim tab would show claim-token-reward
  • stacking tab would show stack-tokens
  • stacking claim tab would show claim-stacking-reward

Upgrade Bootstrap 4 to 5

Not sure how much of a change this would be, but definitely something to look at if it's going to be a template moving forward.

🐞[BUG] full profile component not loaded until refresh

image

The small profile component loads a larger offcanvas tab for the full profile component.

After first login, the data on this element is not updated until the page is refreshed one time. It should update based on the login action.

(also ties in to #32)

Note: initial value is undefined based on the View on Explorer button

Develop Web UI for Mining and Stacking

Initial list of criteria based on PRD below:

  • a miner can submit STX to the contract using the Stacks Web Wallet
  • a miner can choose to submit for one or multiple blocks at a given rate
  • a miner can see available citycoin rewards and claim them
  • a miner can see their mining history, stored in Gaia (TBF)
  • a Stacker can submit citycoin to the contract using the Stacks Web Wallet
  • a Stacker can choose the number of reward cycles to participate in
  • a Stacker can see available STX rewards and claim them
  • a Stacker can see their Stacking history, stored in Gaia (TBF)

General UI flow outlined here:
https://miro.com/app/board/o9J_lGTdbbg=/?moveToWidget=3074457358599766193&cot=14

Revisit page structure

As we add more info things are starting to feel cluttered, and we should revisit the layout of content.

Now that we have pox-lite info, we are looking at what stats would be useful to miners in #13, and as more items come up, I think it makes sense to separate things out into pages:

  • Registration
  • Dashboard (Stats)
  • Mining
  • Stacking

I will look at this against the original Miro drawing in #7 and draft up a wireframe before we go too deep into it. Since we have a good grid system with bootstrap there's probably a better way to lay it out then just the side by side with profile + info cards anyway.

Recording my thoughts here for now, more to come!

Dashboard: make information more accessible / useful

Right now I wired up the dashboard to show PoX stats from the contract as well as an activity log (thanks to @friedger adding the CityCoinTxList component).

The layout is a little messy, and it should be easier to read and understand what information is being presented.

Are there other things we should display here? What is most useful to the user?

Should the information be split into relevant tabs, e.g. mining stats like #13 displayed on the mining tab?

Registration: show activation delay

There is a delay between meeting the number of required signalling miner and the actual mining. (100 blocks)

The UI should show when mining is available.

🐞[BUG] activity log accordion is broken

The accordion used to display the activity log is broken.

The naming for each item uses the same IDs for each entry, so they all expand/contract at the same time.

In the CityCoinTxList component, the key used for iterating over the blockHeights array should set the following values for each component it creates, rather than just reuse the same One for all:

<h2 class="accordion-header" id="accordionActivityLog-headingOne">
data-bs-target="#accordionActivityLog-activityOne"
aria-controls="accordionActivityLog-activityOne"
id="accordionActivityLog-activityOne"
aria-labelledby="accordionActivityLog-headingOne"

As part of #31 I added number-to-words as a dependency, which should make it easy to take the key and convert it into the relevant IDs and values. e.g. below:

import converter from 'number-to-words';

converter.toWords(13); // => β€œthirteen”

🐞[BUG]

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Add warning for mobile users

Given Stacks Wallet for Web doesn't work on mobile without some interesting tricks, we should present users with a splash screen that tells them mining/stacking should be done from the desktop.

⚑[FEAT] display more info on mining tab

Three things that would be helpful from the mining tab, open to more ideas as well!

  • display active miners this block on mining tab against 128 limit
  • display current block height on mining tab
  • display average commit of last 5, 30, 100, 300 blocks mined on mining tab (see #13)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.