Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
frontend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Package registry
Container registry
Operate
Terraform modules
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
frontend
Commits
ed3f8234
Commit
ed3f8234
authored
1 month ago
by
Simon Künzel
Browse files
Options
Downloads
Patches
Plain Diff
#98
Improve Announcement UX
parent
33628bee
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
lang/de.slf
+3
-0
3 additions, 0 deletions
lang/de.slf
lang/en.slf
+3
-0
3 additions, 0 deletions
lang/en.slf
src/videoag/site/AnnouncementComponent.tsx
+19
-12
19 additions, 12 deletions
src/videoag/site/AnnouncementComponent.tsx
with
25 additions
and
12 deletions
lang/de.slf
+
3
−
0
View file @
ed3f8234
...
@@ -157,6 +157,9 @@ setting.entry.notifications_responsible_courses_chapter_submitted = "... ein Kap
...
@@ -157,6 +157,9 @@ setting.entry.notifications_responsible_courses_chapter_submitted = "... ein Kap
setting.entry.notifications_responsible_courses_changes = "... ein anderer Benutzer Felder (z.B. Titel oder Kommentar) geändert hat"
setting.entry.notifications_responsible_courses_changes = "... ein anderer Benutzer Felder (z.B. Titel oder Kommentar) geändert hat"
ui.announcement.info_static_not_editable = "Dies ist eine dynamische Ankündigung, welche vom Server kommt und nicht bearbeitet werden kann"
ui.announcement.info_static_not_editable = "Dies ist eine dynamische Ankündigung, welche vom Server kommt und nicht bearbeitet werden kann"
ui.announcement.info_hide_disabled_in_edit_mode = """
Du kannst aktuell alle Ankündigungen sehen um diese zu bearbeiten, daher kannst du diese Ankündigung nicht verstecken.
"""
ui.announcement.create_new = "Neue Ankündigung"
ui.announcement.create_new = "Neue Ankündigung"
ui.object.field_supports_markdown = """
ui.object.field_supports_markdown = """
...
...
This diff is collapsed.
Click to expand it.
lang/en.slf
+
3
−
0
View file @
ed3f8234
...
@@ -157,6 +157,9 @@ setting.entry.notifications_responsible_courses_chapter_submitted = "... a chapt
...
@@ -157,6 +157,9 @@ setting.entry.notifications_responsible_courses_chapter_submitted = "... a chapt
setting.entry.notifications_responsible_courses_changes = "... another user fields (e.g. title, comment) changed"
setting.entry.notifications_responsible_courses_changes = "... another user fields (e.g. title, comment) changed"
ui.announcement.info_static_not_editable = "This is a dynamic announcement provided by the server, which can not be edited"
ui.announcement.info_static_not_editable = "This is a dynamic announcement provided by the server, which can not be edited"
ui.announcement.info_hide_disabled_in_edit_mode = """
You can currently see all announcements to edit them, and therefore you can't hide this announcement.
"""
ui.announcement.create_new = "New announcement"
ui.announcement.create_new = "New announcement"
ui.object.field_supports_markdown = """
ui.object.field_supports_markdown = """
...
...
This diff is collapsed.
Click to expand it.
src/videoag/site/AnnouncementComponent.tsx
+
19
−
12
View file @
ed3f8234
...
@@ -46,6 +46,7 @@ export default function AnnouncementComponent({
...
@@ -46,6 +46,7 @@ export default function AnnouncementComponent({
);
);
const
isHome
=
router
.
asPath
===
"
/
"
;
const
isHome
=
router
.
asPath
===
"
/
"
;
const
allowEditing
=
editMode
&&
isHome
;
const
hideAnnouncement
=
(
announcement
:
announcement
)
=>
const
hideAnnouncement
=
(
announcement
:
announcement
)
=>
setHiddenAnnouncements
((
oldHidden
:
string
[])
=>
{
setHiddenAnnouncements
((
oldHidden
:
string
[])
=>
{
...
@@ -70,7 +71,7 @@ export default function AnnouncementComponent({
...
@@ -70,7 +71,7 @@ export default function AnnouncementComponent({
return
(
return
(
<
div
>
<
div
>
{
editMode
&&
(
{
allowEditing
&&
(
<
div
className
=
""
>
<
div
className
=
""
>
<
OMCreate
object_type
=
"announcement"
>
<
OMCreate
object_type
=
"announcement"
>
<
button
className
=
"btn btn-secondary mb-3 w-100"
type
=
"button"
>
<
button
className
=
"btn btn-secondary mb-3 w-100"
type
=
"button"
>
...
@@ -88,7 +89,7 @@ export default function AnnouncementComponent({
...
@@ -88,7 +89,7 @@ export default function AnnouncementComponent({
if
(
announcement
.
page_visibility
==
"
only_main_page
"
&&
!
isHome
)
return
null
;
if
(
announcement
.
page_visibility
==
"
only_main_page
"
&&
!
isHome
)
return
null
;
if
(
!
forceShowHidden
&&
!
editMode
&&
hiddenAnnouncements
.
includes
(
hash
))
if
(
!
forceShowHidden
&&
!
allowEditing
&&
hiddenAnnouncements
.
includes
(
hash
))
return
null
;
return
null
;
return
(
return
(
...
@@ -97,7 +98,7 @@ export default function AnnouncementComponent({
...
@@ -97,7 +98,7 @@ export default function AnnouncementComponent({
key
=
{
hash
+
"
#
"
+
ind
}
key
=
{
hash
+
"
#
"
+
ind
}
role
=
"alert"
role
=
"alert"
>
>
{
announcement
.
id
?
(
{
announcement
.
id
&&
allowEditing
?
(
<
EmbeddedOMFieldComponent
<
EmbeddedOMFieldComponent
object_type
=
"announcement"
object_type
=
"announcement"
object_id
=
{
announcement
.
id
}
object_id
=
{
announcement
.
id
}
...
@@ -114,7 +115,7 @@ export default function AnnouncementComponent({
...
@@ -114,7 +115,7 @@ export default function AnnouncementComponent({
)
}
)
}
<
div
className
=
"flex-grow-1"
/>
<
div
className
=
"flex-grow-1"
/>
{
editMode
&&
{
allowEditing
&&
(
announcement
.
id
?
(
(
announcement
.
id
?
(
<>
<>
<
OMEdit
<
OMEdit
...
@@ -134,13 +135,19 @@ export default function AnnouncementComponent({
...
@@ -134,13 +135,19 @@ export default function AnnouncementComponent({
)
}
)
}
</
TooltipButton
>
</
TooltipButton
>
))
}
))
}
{
!
forceShowHidden
&&
!
editMode
&&
(
{
!
forceShowHidden
&&
(
<
span
className
=
"d-flex align-items-center"
title
=
{
allowEditing
?
language
.
get
(
"
ui.announcement.info_hide_disabled_in_edit_mode
"
)
:
""
}
>
<
button
<
button
type
=
"button"
type
=
"button"
className
=
"btn-close "
className
=
"btn-close
ms-1
"
aria-label
=
"Close"
aria-label
=
"Close"
disabled
=
{
allowEditing
}
onClick
=
{
()
=>
hideAnnouncement
(
announcement
)
}
onClick
=
{
()
=>
hideAnnouncement
(
announcement
)
}
/>
/>
</
span
>
)
}
)
}
</
div
>
</
div
>
);
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment