-
Notifications
You must be signed in to change notification settings - Fork 1
Sigurd/web 53 event pages edit or delete buttons #1976
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
Open
0xSpecter
wants to merge
56
commits into
master
Choose a base branch
from
sigurd/web-53-event-pages-edit-or-delete-buttons
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 11 commits
Commits
Show all changes
56 commits
Select commit
Hold shift + click to select a range
575a499
Add darkmode to storybook
eilifhl fa443e5
Remove bg color
eilifhl f14c2a2
Revise Venue Opening Dto
eilifhl a1d65d0
Change route naming
eilifhl 9d3231f
Change request from patch to get
eilifhl cb63071
Create open_venues function in VenueView
eilifhl 532c81b
Generate routes
eilifhl 1bd43d8
Remove irrelevant routes changes
eilifhl 9d3188e
Merge branch 'master' into Eilif/1942-get-opening-hours-for-homepage-…
eilifhl 9781938
Refactor api call to deliver venue list instead of new datatype
eilifhl 697e60e
Merge branch 'master' into Eilif/1942-get-opening-hours-for-homepage-…
eilifhl 567abe2
Create container component
eilifhl c8e02d5
Merge branch 'Eilif/1942-get-opening-hours-for-homepage-backend' of g…
eilifhl e01573d
Refactor so all logic is in OpeningHours.tsx
eilifhl fcb4de4
Remove OpeningHoursContainer from HomePage
eilifhl dc90eb2
BIOMEEEEEE
eilifhl 2880626
STYLELIIIIIIIIIIIIIIIIIIIIIIIIIIIIIIINTTTTTT
eilifhl 4df319a
Add correct storybook data
eilifhl 4779db9
added edit button inside of event page
0xSpecter 5dde5b1
added edit button to image card in events page
0xSpecter b058f47
fixes
0xSpecter 2055936
fixed stylelint problems
0xSpecter 388bed0
Fix styling of tableCell border
eilifhl 330f699
Venues with midnight opening, closing are closed
eilifhl c57912f
Added event edit, delete and django access buttons on event card and …
0xSpecter b7cedc0
fixed formatation
0xSpecter 042e83b
fixed non selfClosing without children
0xSpecter fa1d5e8
fixed typescript issue that appeared in another file
0xSpecter 1b21620
Opening hours now display a descriptiv message when samf is in a clos…
0xSpecter 1452dcf
changed text used from description to message
0xSpecter f8ceeaa
removed accidental openingHours in homepage
0xSpecter 9da6fd7
work in progress
0xSpecter fd87ed6
...
0xSpecter 72f41de
e
0xSpecter 5b2cf30
renamed message_nb to message_no for consistancy. removed desvription…
0xSpecter ab0969b
begynnelse av data sjekk
0xSpecter 0f257d0
You can now safely post closedPeriods in the admin panal, aswell as i…
0xSpecter 4509f48
added a checkbox for making samf closed, needs to be implemented in m…
0xSpecter c050015
added check for id for showing editing buttons and added id into admi…
0xSpecter d162b0a
should be fixed now
0xSpecter b54fbef
ok now its good
0xSpecter 5aa8e0c
changed closedPeriodadmin to match
0xSpecter 8cd5403
biome fix
0xSpecter b0edf96
added radio buttons for choosing default, forced open or forced close…
0xSpecter bc93e7e
readded almost sold out button
0xSpecter 30d578e
fixed old copyed code carrying over due too blindness
0xSpecter 833e732
biome fix
0xSpecter 5a09679
ruff reformat
0xSpecter 5f5b7af
make migration problems that now should be fixed
0xSpecter 714977f
Merge branch 'sigurd/web-73-closed-periods-admin-page' into sigurd/we…
0xSpecter 6c1d56d
Merge branch 'master' into sigurd/web-53-event-pages-edit-or-delete-b…
0xSpecter 1e37f56
removed the scary file
0xSpecter e860d34
fixing migrations
0xSpecter a8be990
Merge branch 'master' into sigurd/web-53-event-pages-edit-or-delete-b…
0xSpecter c2e7f35
fixed goof merge with main
0xSpecter 849f2dc
Merge branch 'master' into sigurd/web-53-event-pages-edit-or-delete-b…
0xSpecter File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
46 changes: 46 additions & 0 deletions
46
frontend/src/Components/EventEditButtons/EventEditButtons.module.scss
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,46 @@ | ||
| .edit_icon { | ||
| color: white; | ||
| filter: brightness(1000%); | ||
| transition: all 200ms ease-in-out; | ||
| } | ||
|
|
||
|
|
||
| .edit_button { | ||
| pointer-events:all; | ||
| z-index: 10; | ||
| border-radius: 30%; | ||
| width: fit-content; | ||
| padding: 4px; | ||
| color: white; | ||
| cursor: pointer; | ||
| transition: all 200ms ease-in-out; | ||
| box-shadow: rgba(0, 0, 0, 0.24) 0 3px 8px; | ||
| text-decoration: none; | ||
| } | ||
|
|
||
| .edit_button:hover { | ||
| .edit_icon { | ||
| rotate: 15deg; | ||
| } | ||
| scale: 1.1; | ||
| filter: brightness(110%); | ||
| } | ||
|
|
||
| .default_edit { | ||
| @extend .edit_button; | ||
| background: #3498db; | ||
| } | ||
|
|
||
| .detail_edit { | ||
| @extend .edit_button; | ||
| background: teal; | ||
| } | ||
|
|
||
| .delete_edit { | ||
| @extend .edit_button; | ||
| background: crimson; | ||
| appearance: none; | ||
| border: none; | ||
| } | ||
|
|
||
|
|
21 changes: 21 additions & 0 deletions
21
frontend/src/Components/EventEditButtons/EventEditButtons.stories.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| import type { Meta, StoryObj } from '@storybook/react'; | ||
| import { EventEditButtons } from './EventEditButtons'; | ||
|
|
||
| // Local component config. | ||
| const meta: Meta<typeof EventEditButtons> = { | ||
| title: 'Components/Video', | ||
| component: EventEditButtons, | ||
| args: { | ||
| title: 'Approve', | ||
| }, | ||
| }; | ||
|
|
||
| export default meta; | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cant see this one in storybook |
||
|
|
||
| type Story = StoryObj<typeof EventEditButtons>; | ||
|
|
||
| //export const Basic: Story = { | ||
| // args: { | ||
| // embedId: '88kgbMcDIQ4', | ||
| //}, | ||
| //}; | ||
0xSpecter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
64 changes: 64 additions & 0 deletions
64
frontend/src/Components/EventEditButtons/EventEditButtons.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| import { Icon } from '@iconify/react'; | ||
| import type { ReactNode } from 'react'; | ||
| import { deleteEvent } from '~/api'; | ||
| import { useAuthContext } from '~/context/AuthContext'; | ||
| import { reverse } from '~/named-urls'; | ||
| import { PERM } from '~/permissions'; | ||
| import { ROUTES } from '~/routes'; | ||
| import { hasPerm } from '~/utils'; | ||
| import { Link } from '../Link'; | ||
| import styles from './EventEditButtons.module.scss'; | ||
|
|
||
| type EventEditButtons = { | ||
| title?: ReactNode; | ||
| id?: string; | ||
| icon_size?: number; | ||
| }; | ||
|
|
||
| /** Component for displaying a youtube video */ | ||
0xSpecter marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| export function EventEditButtons({ title = 'event', id, icon_size = 17 }: EventEditButtons) { | ||
| const { user } = useAuthContext(); | ||
| const isStaff = user?.is_staff; | ||
| const canChangeEvent = hasPerm({ user: user, permission: PERM.SAMFUNDET_CHANGE_EVENT, obj: id }); | ||
|
|
||
| const editUrl = reverse({ pattern: ROUTES.frontend.admin_events_edit, urlParams: { id: id } }); | ||
| const detailUrl = reverse({ | ||
| pattern: ROUTES.backend.admin__samfundet_event_change, | ||
| urlParams: { objectId: id }, | ||
| }); | ||
|
|
||
| return ( | ||
| <> | ||
| {canChangeEvent && ( | ||
| <Link className={styles.default_edit} url={editUrl}> | ||
| <Icon className={styles.edit_icon} icon="mdi:pencil" height={icon_size} /> | ||
| </Link> | ||
| )} | ||
| {canChangeEvent && ( | ||
| <button | ||
| className={styles.delete_edit} | ||
| onClick={() => { | ||
| const con = window.confirm(`Are you sure you want to delete ${title}`); | ||
| if (con && id) { | ||
| deleteEvent(id) | ||
| .then(() => { | ||
| alert(`Deleted ${title}`); | ||
| }) | ||
| .catch(() => { | ||
| alert(`Failed to delete ${title}`); | ||
| }); | ||
| } | ||
| }} | ||
| type="button" | ||
| > | ||
| <Icon className={styles.edit_icon} icon="mdi:trash-can-outline" height={icon_size} /> | ||
| </button> | ||
| )} | ||
| {isStaff && canChangeEvent && ( | ||
| <Link className={styles.detail_edit} url={detailUrl} target="backend"> | ||
| <Icon className={styles.edit_icon} icon="vscode-icons:file-type-django" height={icon_size} /> | ||
| </Link> | ||
| )} | ||
| </> | ||
| ); | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { EventEditButtons } from './EventEditButtons'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.