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

✨ Config based UI #123

Merged
merged 23 commits into from
Jun 27, 2024
Merged

✨ Config based UI #123

merged 23 commits into from
Jun 27, 2024

Conversation

foysalit
Copy link
Contributor

Use the config published from ozone server here to only show relevant content based on viewer's role.

Also, display the config in the configuration page.

Screenshot 2024-05-22 at 23 45 13

Dark Mode

Screenshot 2024-05-22 at 23 45 21

Light Mode

Copy link

render bot commented May 22, 2024

Copy link

render bot commented May 22, 2024

@foysalit foysalit changed the base branch from main to config-page May 22, 2024 21:50
@foysalit foysalit requested review from devinivy and bnewbold June 6, 2024 14:39
@foysalit foysalit changed the base branch from config-page to main June 6, 2024 14:40
@foysalit foysalit changed the base branch from main to config-page June 6, 2024 14:42
lib/client.ts Outdated
throw new Error(
"Account does not have access to this Ozone service. If this seems in error, check Ozone's access configuration.",
)
throwUnAuthorizedError()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's definitely a nit, but I think it's nice to keep control flow transparent— throwing is already a part of the language that can be a little difficult to reason about (at least for me!) 😆

The suggestion here would be to reorganize it so that it's something like:

Suggested change
throwUnAuthorizedError()
throw createUnauthorizedError()

One upside of doing things this way is that typescript can tell when code is unreachable after a throw or certain if conditions are guaranteed to have been met (similar to its treatment of return). When the throw is behind a function it's a bit less transparent. (The syntax highlighting around control flow statements is also a win!) It's not actually a real issue here, in my view it's just a nice standard practice to lean that works well in trickier cases.

Comment on lines +32 to +36
canManageTemplates: isModerator,
canTakedown: !!config.pds?.url && isModerator,
canLabel: isModerator,
canManageChat: !!config.chat?.url && isModerator,
canSendEmail: !!config.pds?.url && isModerator,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just double-checking that there aren't any admin-only actions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there are a couple of admin only things like managing team members (which we just merged) and feedgen takedown and I just added those 2 in.

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lovely

@foysalit foysalit changed the base branch from config-page to main June 27, 2024 10:38
@foysalit foysalit merged commit d9c3e8c into main Jun 27, 2024
@matthieusieben matthieusieben deleted the config-based-ui branch November 15, 2024 14:54
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