-
Notifications
You must be signed in to change notification settings - Fork 1
Add social media links to create events #2093
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
hei98
wants to merge
25
commits into
master
Choose a base branch
from
heiheidi/web-75-add-social-media-links-to-create-events
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 all commits
Commits
Show all changes
25 commits
Select commit
Hold shift + click to select a range
007fe64
Add social media links in backend and eventschema
hei98 2428fd8
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 107d940
Add translations for SoMe links
hei98 f034209
Add SoMe links to event
hei98 efc59a9
Add SoMe links to create events and fix styling
hei98 7a9f47f
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 95a7b5a
Add migrations
hei98 d183925
Fix editing so it returns links if any
hei98 9f8097d
Fix biome
hei98 ae18ed7
Remove blank line with whitespace
hei98 9b4cf65
Change from px to em
hei98 f193a8c
Change from px to em
hei98 09f1996
Require http/https for optional urls
hei98 e8380e4
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 a5c72ca
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 64fe9be
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 8e48756
Remove custom_ticket changes
hei98 854cbe6
Fix translations
hei98 944a5e0
Add missing translations
hei98 9ea1636
Remove unused and change to rem
hei98 b1f515c
Make social media links optional in eventdto
hei98 ad03022
Move optional for social medial links to the shcema
hei98 6f4f865
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 cf1a508
Fix based on comments on pr
hei98 378b8bd
Merge branch 'master' into heiheidi/web-75-add-social-media-links-to-…
hei98 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
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
48 changes: 48 additions & 0 deletions
48
backend/samfundet/migrations/0006_event_general_link_event_lastfm_link_and_more.py
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,48 @@ | ||
| # Generated by Django 5.2.11 on 2026-03-05 17:52 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ('samfundet', '0005_medlemsinfo'), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='general_link', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='lastfm_link', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='soundcloud_link', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='spotify_uri', | ||
| field=models.CharField(blank=True, max_length=200, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='vimeo_link', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='youtube_embed', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| migrations.AddField( | ||
| model_name='event', | ||
| name='youtube_link', | ||
| field=models.URLField(blank=True, null=True), | ||
| ), | ||
| ] |
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
91 changes: 91 additions & 0 deletions
91
frontend/src/PagesAdmin/EventCreatorAdminPage/steps/SocialMediaStep.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,91 @@ | ||
| import type { UseFormReturn } from 'react-hook-form'; | ||
| import { useTranslation } from 'react-i18next'; | ||
| import { FormControl, FormField, FormItem, FormLabel, FormMessage, Input } from '~/Components'; | ||
| import { FormDescription } from '~/Components/Forms/Form'; | ||
| import { KEY } from '~/i18n/constants'; | ||
| import styles from '../EventCreatorAdminPage.module.scss'; | ||
| import type { EventFormType } from '../EventCreatorSchema'; | ||
| import type { FormType } from '../hooks/useEventCreatorForm'; | ||
|
|
||
| type SocialLinkKey = Extract< | ||
| keyof EventFormType, | ||
| | 'spotify_uri' | ||
| | 'youtube_link' | ||
| | 'youtube_embed' | ||
| | 'facebook_link' | ||
| | 'soundcloud_link' | ||
| | 'instagram_link' | ||
| | 'x_link' | ||
| | 'lastfm_link' | ||
| | 'vimeo_link' | ||
| | 'general_link' | ||
| >; | ||
|
|
||
| type Props = { | ||
| form: UseFormReturn<FormType>; | ||
| }; | ||
|
|
||
| export const SOCIAL_KEYS: readonly SocialLinkKey[] = [ | ||
| 'spotify_uri', | ||
| 'youtube_link', | ||
| 'youtube_embed', | ||
| 'facebook_link', | ||
| 'soundcloud_link', | ||
| 'instagram_link', | ||
| 'x_link', | ||
| 'lastfm_link', | ||
| 'vimeo_link', | ||
| 'general_link', | ||
| ] as const; | ||
|
|
||
| export function SocialMediaStep({ form }: Props) { | ||
| const { t } = useTranslation(); | ||
|
|
||
| const SOCIAL_LABELS: Record<SocialLinkKey, string> = { | ||
| spotify_uri: 'Spotify URI', | ||
| youtube_link: `YouTube ${t(KEY.common_link)}`, | ||
| youtube_embed: 'YouTube embed', | ||
| facebook_link: `Facebook ${t(KEY.common_link)}`, | ||
| soundcloud_link: `SoundCloud ${t(KEY.common_link)}`, | ||
| instagram_link: `Instagram ${t(KEY.common_link)}`, | ||
| x_link: `X ${t(KEY.common_link)}`, | ||
| lastfm_link: `Last.fm ${t(KEY.common_link)}`, | ||
| vimeo_link: `Vimeo ${t(KEY.common_link)}`, | ||
| general_link: t(KEY.event_general_link), | ||
| }; | ||
|
|
||
| const SOCIAL_MEDIA_HELP: Partial<Record<SocialLinkKey, string>> = { | ||
| spotify_uri: t(KEY.event_spotify_uri_help), | ||
| youtube_link: t(KEY.event_youtube_link_help), | ||
| youtube_embed: t(KEY.event_youtube_embed_help), | ||
| }; | ||
|
|
||
| return ( | ||
| <> | ||
| <div className={styles.socialMediaGrid}> | ||
| {SOCIAL_KEYS.map((name) => ( | ||
| <FormField | ||
| key={name} | ||
| name={name} | ||
| control={form.control} | ||
| render={({ field }) => ( | ||
| <FormItem className={styles.socialMediaItem}> | ||
| <FormLabel className={styles.socialMediaLabel}>{SOCIAL_LABELS[name]}</FormLabel> | ||
| <FormControl> | ||
| <Input | ||
| className={styles.socialMediaInput} | ||
| type="text" | ||
| {...field} | ||
| placeholder={name === 'spotify_uri' ? 'spotify:...' : 'https://...'} | ||
| /> | ||
| </FormControl> | ||
| {SOCIAL_MEDIA_HELP[name] ? <FormDescription>{SOCIAL_MEDIA_HELP[name]}</FormDescription> : null} | ||
| <FormMessage /> | ||
| </FormItem> | ||
| )} | ||
| /> | ||
| ))} | ||
| </div> | ||
| </> | ||
| ); | ||
| } | ||
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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bruke translation her? Er vell egentlig "lenke" istedenfor "link" på norsk. Usikker på "Spotify URI" og "YouTube embed" for det blir jo likt mellom norsk og engelsk.
Har lav betydning, for folk forstår "link".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
La til oversettelse for link/lenke nå