Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: implemented bounty card store #812

Merged
merged 1 commit into from
Dec 25, 2024

Conversation

Ekep-Obasi
Copy link
Contributor

@Ekep-Obasi Ekep-Obasi commented Dec 24, 2024

Describe your changes

Issue ticket number and link: https://community.sphinx.chat/bounty/3079

https://www.loom.com/share/443426a3990841988cd044eb6258a10e?sid=80f36b1e-d876-4335-becb-5a3093182e42

BountyCard Store Usage Patterns

// 1. Initialize store with workspace
const bountyStore = useBountyCardStore(workspaceId);

// 2. Access bounty data
const { bountyCards, loading, error } = bountyStore;

Common Usage Patterns

1. Workspace View Implementation

const WorkspaceView = observer(() => {
  const { uuid } = useParams<{ uuid: string }>();
  const bountyStore = useBountyCardStore(uuid);

  return (
    <div>
      {bountyStore.loading ? (
        <LoadingSpinner />
      ) : (
        <BountyList cards={bountyStore.bountyCards} />
      )}
    </div>
  );
});

2. Handling Workspace Switches

useEffect(() => {
  if (newWorkspaceId) {
    bountyStore.switchWorkspace(newWorkspaceId);
  }
}, [newWorkspaceId]);

3. Implementing Pagination

// Load more button implementation
const LoadMoreButton = observer(() => {
  const hasMorePages = 
    bountyStore.pagination.currentPage * bountyStore.pagination.pageSize < 
    bountyStore.pagination.total;

  return hasMorePages ? (
    <button onClick={() => bountyStore.loadNextPage()}>
      Load More
    </button>
  ) : null;
});

4. Error Handling

const WorkspaceError = observer(() => {
  if (!bountyStore.error) return null;

  return (
    <div className="error-container">
      <p>{bountyStore.error}</p>
      <button onClick={() => bountyStore.loadWorkspaceBounties()}>
        Retry
      </button>
    </div>
  );
});

@Ekep-Obasi Ekep-Obasi force-pushed the feat/bounty-card-store branch 4 times, most recently from a7b0c2f to ac137f3 Compare December 25, 2024 00:59
@Ekep-Obasi Ekep-Obasi force-pushed the feat/bounty-card-store branch from ac137f3 to fd0a34e Compare December 25, 2024 02:56
@humansinstitute humansinstitute merged commit fa35b8f into stakwork:master Dec 25, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants