Skip to content
Snippets Groups Projects
Commit 3f450094 authored by Thomas Hackl's avatar Thomas Hackl
Browse files

Resolve "Polishing der neuen Notifications"

Closes #4432

Merge request studip/studip!3221
parent b665fa8d
No related branches found
No related tags found
No related merge requests found
...@@ -337,7 +337,7 @@ class Seminar_Auth ...@@ -337,7 +337,7 @@ class Seminar_Auth
unset($_SESSION['semi_logged_in']); // used by email activation unset($_SESSION['semi_logged_in']); // used by email activation
$login_template = $GLOBALS['template_factory']->open('loginform'); $login_template = $GLOBALS['template_factory']->open('loginform');
if (isset($this->auth['uname']) && $this->error_msg) { if (isset($this->auth['uname']) && $this->error_msg) {
PageLayout::postException(_('Bei der Anmeldung trat ein Fehler auf!'), $this->error_msg); PageLayout::postError(_('Bei der Anmeldung trat ein Fehler auf!'), $this->error_msg);
} }
$login_template->set_attribute('error_msg', $this->error_msg); $login_template->set_attribute('error_msg', $this->error_msg);
$login_template->set_attribute('uname', (isset($this->auth["uname"]) ? $this->auth["uname"] : Request::username('loginname'))); $login_template->set_attribute('uname', (isset($this->auth["uname"]) ? $this->auth["uname"] : Request::username('loginname')));
......
File added
File added
File added
@use 'variables';
#system-notifications { #system-notifications {
&.bottom-right { &.bottom-right {
bottom: 50px; bottom: 40px;
right: 15px; right: 15px;
.system-notification { .system-notification {
box-shadow: 5px 5px var(--dark-gray-color-10);
&.system-notification-slide-enter, &.system-notification-slide-enter,
&.system-notification-slide-leave-to { &.system-notification-slide-leave-to {
opacity: 0; opacity: 0;
...@@ -17,16 +17,25 @@ ...@@ -17,16 +17,25 @@
opacity: 1; opacity: 1;
transform: translateX(0); transform: translateX(0);
} }
&.system-notification-slide-enter-active,
&.system-notification-slide-leave-active {
transition: all var(--transition-duration-superslow) ease-in-out;
}
} }
&:not(.system-notifications-login) {
position: fixed;
width: 400px;
}
} }
&.top-center { &.top-center {
left: calc(50% - 300px); left: calc(50% - 300px);
top: 0; top: 41px;
.system-notification { .system-notification {
box-shadow: 0 0 0 3px var(--dark-gray-color-10);
&.system-notification-slide-enter, &.system-notification-slide-enter,
&.system-notification-slide-leave-to { &.system-notification-slide-leave-to {
opacity: 0; opacity: 0;
...@@ -38,36 +47,40 @@ ...@@ -38,36 +47,40 @@
opacity: 1; opacity: 1;
transform: translateY(0); transform: translateY(0);
} }
&.system-notification-slide-enter-active,
&.system-notification-slide-leave-active {
transition: all var(--transition-duration-slow) ease-in-out;
}
}
&:not(.system-notifications-login) {
position: fixed;
width: 600px;
} }
}
&:not(.system-notifications-login) {
position: fixed;
width: 600px;
} }
&.system-notifications-login { &.system-notifications-login {
margin-bottom: 15px; margin-bottom: 15px;
overflow: hidden;
} }
overflow: hidden; overflow: visible;
z-index: 1001; z-index: 1000;
} }
.system-notification { .system-notification {
background-color: var(--content-color-20); background-color: var(--content-color-20);
border: thin solid var(--content-color-40); color: var(--white);
color: var(--black);
cursor: pointer; cursor: pointer;
display: flex; display: flex;
padding: 10px; margin-bottom: 6px;
min-height: 60px;
padding: 5px;
position: relative; position: relative;
&.system-notification-slide-enter-active,
&.system-notification-slide-leave-active {
transition: all var(--transition-duration-slow) ease-in-out;
}
.system-notification-icon { .system-notification-icon {
flex: 0; flex: 0;
padding: 10px; padding: 10px;
...@@ -88,6 +101,7 @@ ...@@ -88,6 +101,7 @@
.system-notification-close { .system-notification-close {
align-self: normal; align-self: normal;
display: none;
flex: 0; flex: 0;
height: 20px; height: 20px;
width: 20px; width: 20px;
...@@ -127,52 +141,73 @@ ...@@ -127,52 +141,73 @@
} }
a:not(.system-notification-message) { a:not(.system-notification-message) {
color: var(--black); color: var(--white);
text-decoration-line: underline; text-decoration-line: underline;
} }
a.system-notification-message { a.system-notification-message {
color: var(--text-color); color: var(--white);
text-decoration: unset; text-decoration: unset;
} }
&:hover {
.system-notification-close {
display: unset;
}
}
} }
.system-notification-exception { .system-notification-exception {
background-color: var(--red-40); background-color: var(--red);
color: var(--white);
.system-notification-timeout { .system-notification-timeout {
background-color: var(--red); background-color: var(--red-40);
} }
} }
.system-notification-error { .system-notification-error {
background-color: var(--red-20); background-color: var(--red);
color: var(--white);
.system-notification-timeout { .system-notification-timeout {
background-color: var(--red-80); background-color: var(--red-40);
} }
} }
.system-notification-warning { .system-notification-warning {
background-color: var(--yellow-20); background-color: var(--yellow);
color: var(--black);
.system-notification-timeout { .system-notification-timeout {
background-color: var(--yellow-80); background-color: var(--yellow-40);
} }
a:not(.system-notification-message) {
color: var(--black);
text-decoration-line: underline;
}
a.system-notification-message {
color: var(--white);
text-decoration: unset;
}
} }
.system-notification-success { .system-notification-success {
background-color: var(--green-20); background-color: var(--green);
.system-notification-timeout { .system-notification-timeout {
background-color: var(--green-80); background-color: var(--green-40);
} }
} }
.system-notification-info { .system-notification-info {
background-color: var(--dark-violet-20); background-color: var(--dark-violet);
.system-notification-timeout { .system-notification-timeout {
background-color: var(--dark-violet-60); background-color: var(--dark-violet-40);
} }
} }
...@@ -44,6 +44,7 @@ $drag_and_drop_border: 1px solid $base-color; ...@@ -44,6 +44,7 @@ $drag_and_drop_border: 1px solid $base-color;
$transition-duration: .3s; $transition-duration: .3s;
$transition-duration-slow: .5s; $transition-duration-slow: .5s;
$transition-duration-superslow: 1s;
// Layout // Layout
$page-margin: 15px; $page-margin: 15px;
...@@ -177,6 +178,7 @@ $grid-gap: 0; ...@@ -177,6 +178,7 @@ $grid-gap: 0;
#{"--"}transition-duration: $transition-duration; #{"--"}transition-duration: $transition-duration;
#{"--"}transition-duration-slow: $transition-duration-slow; #{"--"}transition-duration-slow: $transition-duration-slow;
#{"--"}transition-duration-superslow: $transition-duration-superslow;
@media (prefers-reduced-motion) { @media (prefers-reduced-motion) {
#{"--"}transition-duration: 0s; #{"--"}transition-duration: 0s;
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
> >
<div class="system-notification-icon"> <div class="system-notification-icon">
<studip-icon :shape="icon.shape" <studip-icon :shape="icon.shape"
:size="48" :size="40"
:role="icon.color" :role="icon.color"
alt="" alt=""
title=""></studip-icon> title=""></studip-icon>
...@@ -41,6 +41,7 @@ ...@@ -41,6 +41,7 @@
@keydown.space="destroyMe" @keydown.space="destroyMe"
tabindex="0"> tabindex="0">
<studip-icon shape="decline" <studip-icon shape="decline"
:role="icon.color"
:size="20" :size="20"
class="close-system-notification"/> class="close-system-notification"/>
</button> </button>
...@@ -74,6 +75,10 @@ export default { ...@@ -74,6 +75,10 @@ export default {
visibleFor: { visibleFor: {
type: Number, type: Number,
default: 5000 default: 5000
},
placement: {
type: String,
default: 'topcenter'
} }
}, },
data() { data() {
...@@ -97,25 +102,7 @@ export default { ...@@ -97,25 +102,7 @@ export default {
}, },
icon() { icon() {
let iconShape = 'info-circle'; let iconShape = 'info-circle';
let iconColor = 'info'; let iconColor = this.notification.type === 'warning' ? 'info' : 'info_alt';
switch (this.type) {
case 'exception':
iconShape = 'exclaim-circle';
iconColor = 'info_alt';
break;
case 'error':
iconShape = 'exclaim-circle';
iconColor = 'status-red';
break;
case 'warning':
iconShape = 'exclaim-circle';
iconColor = 'status-yellow';
break;
case 'success':
iconShape = 'check-circle';
iconColor = 'status-green';
break;
}
return {shape: iconShape, color: iconColor}; return {shape: iconShape, color: iconColor};
}, },
isDisrupted() { isDisrupted() {
...@@ -162,8 +149,29 @@ export default { ...@@ -162,8 +149,29 @@ export default {
this.globalOn('resume-system-notifications', this.initTimeout); this.globalOn('resume-system-notifications', this.initTimeout);
if (!STUDIP.config?.PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED) { if (!STUDIP.config?.PERSONAL_NOTIFICATIONS_AUDIO_DEACTIVATED) {
const audio = new Audio(STUDIP.ASSETS_URL + '/sounds/blubb.mp3'); let audio = null;
audio.play(); switch (this.notification.type) {
case 'info':
audio = new Audio(STUDIP.ASSETS_URL + '/sounds/notify-ok.mp3');
break;
case 'success':
audio = new Audio(STUDIP.ASSETS_URL + '/sounds/notify-good.mp3');
break;
case 'warning':
case 'error':
case 'exception':
audio = new Audio(STUDIP.ASSETS_URL + '/sounds/notify-bad.mp3');
break;
}
let timing = 300;
if (this.placement === 'bottomright') {
timing = 750;
}
setTimeout(() => {
audio.play();
}, timing);
} }
}, },
destroyed() { destroyed() {
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
<system-notification v-for="notification in allNotifications" <system-notification v-for="notification in allNotifications"
:key="`message-${notification.key}`" :key="`message-${notification.key}`"
:notification="notification" :notification="notification"
:placement="placement"
@destroyMe="destroyNotification(notification)" @destroyMe="destroyNotification(notification)"
></system-notification> ></system-notification>
</transition-group> </transition-group>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment