Skip to content

Commit

Permalink
Merge pull request #1758 from citizenos/##1212
Browse files Browse the repository at this point in the history
  • Loading branch information
ilmartyrk authored Jan 6, 2025
2 parents 421af20 + cad509b commit c2af38d
Show file tree
Hide file tree
Showing 11 changed files with 103 additions and 39 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ yarn-error.log
/libpeerconnection.log
testem.log
/typings
.cursorrules

/config/local.json
/src/assets/config/local.json
Expand Down
7 changes: 3 additions & 4 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,10 @@ export class AppComponent {

const g = outlet?.segments.map(seg => seg.path) || [''];
let langParam = g[0];
console.log(langParam);
if (translate.currentLang !== langParam && translate.getLangs().indexOf(langParam) === -1) {
console.log(this.auth.userLang$.value)
g.unshift(this.auth.userLang$.value || translate.currentLang || translate.getBrowserLang() || translate.getDefaultLang());
this.router.navigate(g, { queryParams: parsedUrl.queryParams, fragment: parsedUrl.fragment || undefined });
console.log((this.auth.userLang$.value || translate.currentLang || translate.getBrowserLang()) ?? translate.getDefaultLang())
g.unshift((this.auth.userLang$.value || translate.currentLang || translate.getBrowserLang()) ?? translate.getDefaultLang());
this.router.navigate(g, { queryParams: parsedUrl.queryParams, fragment: parsedUrl.fragment ?? undefined });
}
else if (translate.currentLang !== langParam) {
if (!this.translateDebug.isDebugMode) {
Expand Down
1 change: 1 addition & 0 deletions src/app/ideation/components/ideabox/ideabox.component.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use "mixins";

.idea {
display: flex;
flex-direction: column;
Expand Down
9 changes: 9 additions & 0 deletions src/app/my-groups/my-groups.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,12 @@
background-color: rgba(44, 59, 71, 0.8);
}
}

.dropdown {
@include mixins.dropdown-style;
min-width: 160px;

@include mixins.mobile {
width: calc(100% - 40px);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ <h4 class="title" translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_TITLE"><!--div c
</label>
<label class="checkbox"><span translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_LBL_TOPIC_UPDATES"></span>
<input type="checkbox" [checked]="preferences.Topic && preferences.TopicReport"
(click)="selectOption('Topic');selectOption('TopicReport');">
(click)="selectOption(['Topic', 'TopicReport']);">
<span class="checkmark"></span>
</label>
<label class="checkbox"><span translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_LBL_TOPIC_DISCUSSION"></span>
<input type="checkbox" [checked]="preferences.Discussion && preferences.DiscussionComment && preferences.CommentVote"
(click)="selectOption('Discussion'); selectOption('DiscussionComment');selectOption('CommentVote');">
(click)="selectOption(['Discussion', 'DiscussionComment', 'CommentVote', 'TopicComment', 'CommentReport' ]);">
<span class="checkmark"></span>
</label>
<label class="checkbox"><span translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_LBL_TOPIC_IDEATION"></span>
<input type="checkbox" [checked]="preferences.Ideation && preferences.IdeaVote && preferences.Idea && preferences.TopicIdeation && preferences.IdeaComment"
(click)="selectOption('TopicIdeation');selectOption('IdeaVote'); selectOption('Idea');selectOption('TopicIdeation');selectOption('IdeaComment');">
(click)="selectOption(['Ideation', 'Idea', 'IdeaVote', 'TopicIdeation', 'IdeaComment', 'IdeationIdea', 'IdeaReport']);">
<span class="checkmark"></span>
</label>
<label class="checkbox"><span translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_LBL_TOPIC_VOTING"></span>
Expand All @@ -81,7 +81,7 @@ <h4 class="title" translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_TITLE"><!--div c
</div>

<div class="dialog_footer with_buttons">
<a dialog-close translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_LNK_CANCEL"></a>
<a dialog-close translate>MODALS.TOPIC_NOTIFICATION_SETTINGS_LNK_CANCEL</a>
<button class="btn_medium_submit" (click)="doSaveSettings();"
translate="MODALS.TOPIC_NOTIFICATION_SETTINGS_BTN_SAVE"></button>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import { Discussion } from 'src/app/interfaces/discussion';
import { Component, OnInit, Input, Inject } from '@angular/core';
import { DialogService, DIALOG_DATA } from 'src/app/shared/dialog';
import { NotificationService } from '@services/notification.service';
import { TopicNotificationService } from '@services/topic-notification.service';
import { TopicService } from '@services/topic.service';
import { tap, map, Observable, take } from 'rxjs';
import { tap, Observable, take } from 'rxjs';
import { Topic } from 'src/app/interfaces/topic';

@Component({
Expand All @@ -25,22 +24,26 @@ export class TopicNotificationSettingsComponent implements OnInit {
DiscussionComment: false,
TopicDiscussion: false,
CommentVote: false,
TopicComment: false,
TopicReport: false,
TopicVoteList: false,
TopicEvent: false,
Ideation: false,
Idea: false,
IdeaVote: false,
TopicIdeation: false,
IdeaComment: false
IdeaComment: false,
IdeationIdea:false,
IdeaReport: false,
CommentReport: false
};
allowNotifications = false
constructor(
private TopicNotificationService: TopicNotificationService,
private Notification: NotificationService,
private Topic: TopicService,
private readonly TopicNotificationService: TopicNotificationService,
private readonly Notification: NotificationService,
private readonly Topic: TopicService,
@Inject(DIALOG_DATA) public data: any,
private dialog: DialogService) {
private readonly dialog: DialogService) {
if (data.topicId)
this.topicId = data.topicId;

Expand Down Expand Up @@ -79,11 +82,14 @@ export class TopicNotificationSettingsComponent implements OnInit {
return (Object.values(this.preferences).indexOf(false) === -1)
};

selectOption(option: string) {
selectOption(options: string | string[]) {
if (!Array.isArray(options)) options = [options];
options.forEach((option) => {
this.preferences[option] = !this.preferences[option];
if (this.preferences[option] === true) {
this.allowNotifications = true;
}
if (this.preferences[option] === true) {
this.allowNotifications = true;
}
});
};

doSaveSettings() {
Expand Down
2 changes: 1 addition & 1 deletion src/app/topic/topic.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -977,7 +977,7 @@
</div>
<div class="info_item" translate="VIEWS.TOPICS_TOPICID.SECTION_NOTIFICATIONS_DESC">
</div>
<button *ngIf="TopicService.canDelete(topic)" class="btn_medium_secondary bold"
<button class="btn_medium_secondary bold"
(click)="app.doShowTopicNotificationSettings(topic.id)">
<div class="icon">
<svg width="25" height="24" viewBox="0 0 25 24" fill="none" xmlns="http://www.w3.org/2000/svg">
Expand Down
5 changes: 5 additions & 0 deletions src/assets/styles/_buttons_new.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
@use "mixins";
@use "variables" as *;

%btn_big {
padding: 8px 24px;
Expand Down Expand Up @@ -562,3 +563,7 @@ $button-styles: (
}
}
}

.btn_submit {
@include mixins.button($color-primary, $color-background);
}
53 changes: 53 additions & 0 deletions src/assets/styles/_mixins.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@use 'variables' as *;

/* cyrillic-ext */
@font-face {
font-family: 'Noto Sans';
Expand Down Expand Up @@ -254,3 +256,54 @@
#{$key}: $value;
}
}

// Mixin for Flex Container
@mixin flex-container($direction: row, $justify: flex-start, $align: flex-start) {
display: flex;
flex-direction: $direction;
justify-content: $justify;
align-items: $align;
}

// Mixin for Buttons
@mixin button($bg-color, $text-color, $border: none, $border-radius: 8px) {
background-color: $bg-color;
color: $text-color;
border: $border;
border-radius: $border-radius;
padding: 8px 16px;
cursor: pointer;
transition: background-color 0.3s ease;

&:hover {
background-color: darken($bg-color, 10%);
}
}

// Mixin for Dropdowns
@mixin dropdown-style {
border: 1px solid $color-border;
border-radius: 8px;
padding: 8px 16px;
background-color: $color-background;
cursor: pointer;
transition: border-color 0.3s ease;

&:hover {
border-color: $color-primary;
}
}

@mixin heading($size) {
font-size: $size;
font-style: normal;
font-weight: 600;
line-height: $size + 4px;

a {
font-size: $size;
font-style: normal;
font-weight: 600;
line-height: $size + 4px;
}
}
6 changes: 6 additions & 0 deletions src/assets/styles/_variables.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
$color-primary: #2196f3;
$color-secondary: #f44336;
$color-background: #ffffff;
$color-text: #252525;
$color-border: #e5e5e5;
// Add more as needed
22 changes: 3 additions & 19 deletions src/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -162,31 +162,15 @@
}

.main_heading {
font-size: 28px;
font-style: normal;
font-weight: 600;
line-height: 32px;
@include mixins.heading(28px);
}

.medium_heading {
font-size: 24px;
font-style: normal;
font-weight: 600;
line-height: 32px;
@include mixins.heading(24px);
}

.small_heading {
font-size: 18px;
font-style: normal;
font-weight: 600;
line-height: 24px;

a {
font-size: 18px;
font-style: normal;
font-weight: 600;
line-height: 24px;
}
@include mixins.heading(18px);
}

a,
Expand Down

0 comments on commit c2af38d

Please sign in to comment.