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

Add tdbytes info page and suggestions #283

Merged
merged 9 commits into from
May 27, 2024
Merged

Add tdbytes info page and suggestions #283

merged 9 commits into from
May 27, 2024

Conversation

otytlandsvik
Copy link
Collaborator

πŸ’Ž Changes

Closes #274

✨ Added a tdBytes page

  • Displays some general info about the kiosk and office
    screenshot-2024-05-05-17:32:24

  • Has a small form at the bottom to submit kiosk product suggestions
    screenshot-2024-05-05-17:32:35

✨ Added a page to view kiosk product suggestions

  • Displays all suggestions in a table
    screenshot-2024-05-05-17:32:07

  • πŸ›‚ Also added a new kiosk admin role, to allow members outside TD-Styret to view suggestions

    • Only admin can fetch names of members who submitted the suggestions
    • Only admin can delete suggestions

Additional changes

  • Also removed obsolete version tag from docker compose files

⚠️ Depends on API PR

@otytlandsvik otytlandsvik self-assigned this May 5, 2024
Copy link

@stiansolli stiansolli left a comment

Choose a reason for hiding this comment

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

Nice work! See comment about changing some text on the td-bytes page

lΓ¦ttis pΓ₯.
</Text>
<Text>
Kontoret skal i utgangspunktet vΓ¦re Γ₯pent i skoletidene, men

Choose a reason for hiding this comment

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

Maybe change info text now that all IFI-students should have access to td-kontoret

Copy link
Member

@FredrikMorstad FredrikMorstad left a comment

Choose a reason for hiding this comment

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

Generally it looks good πŸ™Œ I left one comment on the nature of the suggestion route and maybe it could be a private route allowing the private route to handle any missing authentication

if (role === Roles.admin || role === Roles.kiosk_admin) {
fetchSuggestions();
} else {
setErrMsg('Du har ikke de nΓΈdvendige rettighetene');
Copy link
Member

Choose a reason for hiding this comment

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

Just a question. is it an error if I am on this page as a regular user? Shouldn't the fetch only happen if I have the right access and nothing else if I am a regular user?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

As this is the only kiosk_admin site so far, I think it's reasonable to do the auth check in the page instead of creating another route component to handle it

src/App.tsx Outdated
@@ -65,6 +67,8 @@ const App: React.FC = () => {
/>
<Route path="/about-us" component={AboutPage} />
<Route path="/new-student" component={NewStudentsPage} />
<Route path="/tdbytes/suggestions" component={SuggestionsPage} />
Copy link
Member

Choose a reason for hiding this comment

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

Is this really an open route? isn't this only for members i.e PrivateRoute?

Comment on lines +38 to +40
const moveToLoginPage = () => {
history.push('/login');
};
Copy link
Member

Choose a reason for hiding this comment

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

if the suggestion route is moved to a privet route this can be removed as a the privateRoute sends an unauthorised user to login before redirecting the back to the desired destination. So redirecting to /suggestion automatically sends the user to login if not authenticated

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm thinking the TDBytes page should be viewable to anyone, also if they aren't logged in. Posting suggestions however should require login.

@stiansolli stiansolli requested a review from sdragset May 27, 2024 10:35
@otytlandsvik otytlandsvik merged commit c6c4164 into master May 27, 2024
1 check passed
@otytlandsvik otytlandsvik deleted the feature/tdbytes branch May 27, 2024 20:26
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.

TDbytes page
3 participants