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

[2.0] Re-implement InteractionBarView #1032

Closed
Sjmarf opened this issue Apr 21, 2024 · 0 comments
Closed

[2.0] Re-implement InteractionBarView #1032

Sjmarf opened this issue Apr 21, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Sjmarf
Copy link
Contributor

Sjmarf commented Apr 21, 2024

This should tie into the Action system I implemented in #999. However, not all interaction bar widgets can be represented with actions - the info stack and upvote/downvote counters, for example. Therefore, we'll need some sort of enum to represent widgets, which InteractionBarView could accept an array of. Something roughly like this:

enum InteractionBarWidget {
    case scoreCount(any Interactable1Providing)
    case upvoteCount(any Interactable1Providing)
    case downvoteCount(any Interactable1Providing)
    case infoStack([InfoStackWidget]) // InfoStackWidget is an unimplemented enum
    case action(any Action)
}

If we didn't want to use any Interactable1Providing as arguments of the enum directly, we could instead accept a Counter struct which would be defined roughly like so:

struct Counter {
    let value: Int
    let leadingAction: (any Action)?
    let trailingAction: (any Action)?
}

With InteractionBarWidget looking something like:

enum InteractionBarWidget {
    case infoStack([InfoStackWidget])
    case counter(Counter)
    case action(any Action)
}

Models could be responsible for creating their own Counter objects in computed properties called scoreCounter etc, in the same way that they instantiate their own Action objects.

@Sjmarf Sjmarf added the enhancement New feature or request label Apr 21, 2024
@Sjmarf Sjmarf self-assigned this Jun 14, 2024
@Sjmarf Sjmarf closed this as completed Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Archived in project
Development

No branches or pull requests

1 participant