Skip to content

Help with a couple of things #8

@kennethwsmith

Description

@kennethwsmith

Hey Angel, I was hoping in your spare time you might be able to explain a few things. I am really new to react and was trying to add a few things in slowly to the tool. Also, if there is anything you think I implemented wrong please don't hesitate to reject my pull request, it wont hurt my feelings. :)

So i wanted to add Hacknet hash capacity and Hacknet hash count to the PlayerSave page. Here is my code to add it:

     <div className="flex flex-wrap gap-4">
        <EditableSection
          type="number"
          label="Hacknet Hash Capacity"
          property="hashManager.data.capacity"
          value={player.data.hashManager.data.capacity}
          onSubmit={onSubmit}
        />
      </div>
      <div className="flex flex-wrap gap-4">
        <EditableSection
          type="number"
          label="Hacknet Hashes"
          property="hashManager.data.hashes"
          value={player.data.hashManager.data.hashes}
          onSubmit={onSubmit}
        />
      </div>

I think everything except the property is right. My save file ends up with 2 new root entities: "hashManager.data.hashes" and "hashManager.data.capacity" instead of updating the hashManager object.

I tried playing with the "updatePlayer" method in file.store.ts but everything I did just blew it up.
Also, is there a document on the design pattern you used here, or is this "vanilla react" and I just need to read more.

Thanks for the help!
Ken

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionFurther information is requested

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions