CSC link state to filters

This commit is contained in:
Tykayn 2025-09-10 16:02:31 +02:00 committed by tykayn
parent 0a8088b459
commit 8694a04ea9
31 changed files with 191 additions and 191 deletions

View file

@ -8,6 +8,7 @@
display: inline-block; display: inline-block;
font-family: Barlow; font-family: Barlow;
button { button {
background: shadows.$primary-color; background: shadows.$primary-color;
color: shadows.$neutral-white; color: shadows.$neutral-white;

View file

@ -1 +0,0 @@
<p>index works!</p>

View file

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Index } from './index';
describe('Index', () => {
let component: Index;
let fixture: ComponentFixture<Index>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Index]
})
.compileComponents();
fixture = TestBed.createComponent(Index);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -1,11 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'sae-main-button',
imports: [],
templateUrl: './index.html',
styleUrl: './index.css'
})
export class Index {
}

View file

@ -1 +0,0 @@
<p>index works!</p>

View file

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Index } from './index';
describe('Index', () => {
let component: Index;
let fixture: ComponentFixture<Index>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Index]
})
.compileComponents();
fixture = TestBed.createComponent(Index);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -1,11 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'sae-main-button',
imports: [],
templateUrl: './index.html',
styleUrl: './index.css'
})
export class Index {
}

View file

@ -1,7 +1,17 @@
<div [ngClass]="{highlighted}" class="filter-group"> <div [ngClass]="{highlighted}" class="filter-group">
<div class="selectors"> <div class="selectors">
<sae-multi-selector [label]="'Engine type'"></sae-multi-selector> <sae-multi-selector
<sae-multi-selector [label]="'Findings'"></sae-multi-selector> (availableChoicesChange)="onAvailableChoicesChange"
(selectedChoicesChange)="onSelectedChoicesChange"
[availableChoices]="appState.filters.engineType.availableChoices"
[label]="'Engine type'"
[selectedChoices]="appState.filters.engineType.selectedChoices"
></sae-multi-selector>
<sae-multi-selector
[disabled]="true" [label]="'Findings'"
[selectedChoices]="[]"
></sae-multi-selector>
<sae-multi-selector [label]="'ATA'"></sae-multi-selector> <sae-multi-selector [label]="'ATA'"></sae-multi-selector>
<sae-multi-selector [label]="'Part number'"></sae-multi-selector> <sae-multi-selector [label]="'Part number'"></sae-multi-selector>
<sae-multi-selector [label]="'Technical Manual'"></sae-multi-selector> <sae-multi-selector [label]="'Technical Manual'"></sae-multi-selector>

View file

@ -17,10 +17,8 @@
position: relative; position: relative;
right: 0; right: 0;
top: 0; top: 0;
cursor: pointer; cursor: pointer;
} }
&:hover { &:hover {

View file

@ -13,4 +13,13 @@ import {NgClass} from '@angular/common';
}) })
export class FiltersGroup { export class FiltersGroup {
@Input() highlighted = false; @Input() highlighted = false;
@Input() appState: any = {};
onSelectedChoicesChange(e: any) {
console.log('onSelectedChoicesChange', e);
}
onAvailableChoicesChange(e: any) {
console.log('onSelectedChoicesChange', e);
}
} }

View file

@ -1 +0,0 @@
<p>index works!</p>

View file

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Index } from './index';
describe('Index', () => {
let component: Index;
let fixture: ComponentFixture<Index>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Index]
})
.compileComponents();
fixture = TestBed.createComponent(Index);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -1,11 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'sae-main-button',
imports: [],
templateUrl: './index.html',
styleUrl: './index.css'
})
export class Index {
}

View file

@ -1 +0,0 @@
<p>index works!</p>

View file

@ -1,23 +0,0 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { Index } from './index';
describe('Index', () => {
let component: Index;
let fixture: ComponentFixture<Index>;
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [Index]
})
.compileComponents();
fixture = TestBed.createComponent(Index);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});

View file

@ -1,11 +0,0 @@
import {Component} from '@angular/core';
@Component({
selector: 'sae-main-button',
imports: [],
templateUrl: './index.html',
styleUrl: './index.css'
})
export class Index {
}

View file

@ -13,6 +13,8 @@
name="from_text" name="from_text"
placeholder="" placeholder=""
rows="10"></textarea> rows="10"></textarea>
<sae-main-button></sae-main-button>
<button (click)="clickFileUpload(fileUpload)" class=" click-file-upload is-outlined"> <button (click)="clickFileUpload(fileUpload)" class=" click-file-upload is-outlined">
<i class="ri-upload-cloud-2-line"></i> <i class="ri-upload-cloud-2-line"></i>
<span class="label"> <span class="label">

View file

@ -31,6 +31,10 @@
font-weight: 400; font-weight: 400;
line-height: 140%; line-height: 140%;
} }
.click-file-upload {
cursor: pointer;
}
} }
#fromText { #fromText {

View file

@ -1,10 +1,11 @@
import {Component, EventEmitter, Output} from '@angular/core'; import {Component, EventEmitter, Output} from '@angular/core';
import {FormsModule} from '@angular/forms'; import {FormsModule} from '@angular/forms';
import {Index} from '../index';
@Component({ @Component({
selector: 'sae-translate-texts', selector: 'sae-translate-texts',
standalone: true, standalone: true,
imports: [FormsModule], imports: [FormsModule, Index],
templateUrl: './translate-texts.html', templateUrl: './translate-texts.html',
styleUrl: './translate-texts.scss' styleUrl: './translate-texts.scss'
}) })

View file

@ -1,40 +1,61 @@
<!-- sélecteurs--> <!-- sélecteurs-->
<div class="input-box"> <div [ngClass]="{
'is-disabled': disabled
}"
class="input-box"
>
@if (selectedChoices?.length) {
<div class="selected-items-counter">
{{ selectedChoices.length }}
</div>
}
<i class="ri-search-line search-placeholder"></i> <i class="ri-search-line search-placeholder"></i>
<div class="label"> <div class="label">
<span class="d-none"> <span class="d-none">
{{ label }} {{ label }}
</span> </span>
</div> </div>
<input (blur)="displayDropdown = false" (click)="displayDropdown= !displayDropdown" (focus)="displayDropdown = true" <!-- (blur)="displayDropdown = false" -->
<input
(click)="onClickInput()" (focus)="displayDropdown = true"
class="is-hidden" placeholder="{{label}}" class="is-hidden" placeholder="{{label}}"
type="text"> type="text">
@if (displayDropdown) {
<div class="dropdown">
<div class="dropdown-button selector-button"> <div class="dropdown-button selector-button">
<!-- bouton--> <!-- bouton-->
<i class="ri-arrow-down-s-line"></i> <i class="ri-arrow-down-s-line"></i>
</div> </div>
@if (displayDropdown && availableChoices?.length) {
<div class="dropdown">
<div class="dropdown-list"> <div class="dropdown-list">
<!-- selected:--> <!-- selected:-->
<div class="selected-items"> <div class="selected-items">
@for (sc of selectedChoices; track sc) { @for (sc of selectedChoices; track sc) {
<div class="dropdown-item"> <div class="dropdown-item"
(click)="selectedChoicesChangeToggleItem(sc)"
>
<i class="ri-checkbox-line"></i> <i class="ri-checkbox-line"></i>
{{ sc }} {{ sc }}
</div> </div>
} }
</div> </div>
@if (selectedChoices?.length && availableChoices?.length) {
<hr> <hr>
}
<div class="available-items"> <div class="available-items">
<!-- available:--> <!-- available:-->
@for (c of choices; track c) { @for (ac of availableChoices; track ac) {
<div class="dropdown-item"> <div class="dropdown-item"
(click)="availableChoicesChangeToggleItem(ac)"
>
<i class="ri-checkbox-blank-line"></i> <i class="ri-checkbox-blank-line"></i>
{{ c }} {{ ac }}
</div> </div>
} }
</div> </div>

View file

@ -17,7 +17,7 @@
top: 10px; top: 10px;
} }
.disabled & { &.is-disabled {
color: #525668; color: #525668;
fill: #525668; fill: #525668;
} }
@ -34,8 +34,20 @@
} }
.selector-button { .selector-button {
top: -30px; top: -36px;
right: -177px; right: -165px;
}
.selected-items-counter {
background: blue;
color: white;
border-radius: 200px;
padding: 10px;
display: inline-block;
line-height: 10px;
position: relative;
top: 33px;
left: 136px;
} }
@ -57,7 +69,7 @@
font-size: var(--Font-Base, 14px); font-size: var(--Font-Base, 14px);
.disabled & { .is-disabled & {
border-color: #525668; border-color: #525668;
} }
} }
@ -68,6 +80,19 @@
border-radius: 8px; border-radius: 8px;
position: relative; position: relative;
display: block; display: block;
z-index: 10;
border-top-left-radius: 0;
border-top-right-radius: 0;
top: -28px;
border-left: 1px solid #8D91A4;
border-bottom: 1px solid #8D91A4;
border-right: 1px solid #8D91A4;
.dropdown-list {
max-height: 200px;
overflow-y: auto;
}
.dropdown-item { .dropdown-item {
padding: 4px; padding: 4px;

View file

@ -1,15 +1,57 @@
import {Component, Input} from '@angular/core'; import {Component, EventEmitter, Input, Output} from '@angular/core';
import {NgClass} from '@angular/common';
@Component({ @Component({
selector: 'sae-multi-selector', selector: 'sae-multi-selector',
imports: [], imports: [
NgClass
],
templateUrl: './multi-selector.html', templateUrl: './multi-selector.html',
styleUrl: './multi-selector.scss' styleUrl: './multi-selector.scss'
}) })
export class MultiSelector { export class MultiSelector {
@Input() disabled: boolean = false;
@Input() label!: string; @Input() label!: string;
@Input() choices: any = ['choix 1', 'choix 2', 'choix 3']; // @Input() store: any;
@Input() selectedChoices: any = ['choix 4']; // @Input() ActionTypes: any;
displayDropdown = true; @Input() availableChoices: any = ['choix 1', 'choix 2', 'choix 3'];
@Input() selectedChoices: any = ['choix 4', 'choix 5'];
@Input() displayDropdown: boolean = false;
@Output() selectedChoicesChange = new EventEmitter<any>();
@Output() availableChoicesChange = new EventEmitter<any>();
constructor() {
}
selectedChoicesChangeToggleItem(choice: any) {
console.log('toggle selected choice ', choice, 'in filter ', this.label);
this.selectedChoicesChange.emit(choice);
// console.log(choice);
// this.store.dispatch({
// type: this.ActionTypes.UPDATE_FILTER,
// payload: {
// filter: this.label,
// selectedChoice: choice
// }
// })
}
availableChoicesChangeToggleItem(choice: any) {
this.availableChoicesChange.emit(choice);
console.log('toggle available choice ', choice, 'in filter ', this.label);
// this.store.dispatch({
// type: this.ActionTypes.UPDATE_FILTER,
// payload: {
// filter: this.label,
// availableChoice: choice
// }
// }
// )
}
onClickInput() {
if (this.disabled) return;
this.displayDropdown = !this.displayDropdown
}
} }

View file

@ -27,7 +27,7 @@
<sae-translate-texts></sae-translate-texts> <sae-translate-texts></sae-translate-texts>
</div> </div>
<!-- analyse de question--> <!-- analyse de question-->
<div id="question_alaysis"> <div id="question_analysis">
<h2 class="title"> <h2 class="title">
Question analysis Question analysis
</h2> </h2>
@ -35,8 +35,7 @@
<!--filters--> <!--filters-->
<!-- advanced filters--> <!-- advanced filters-->
<div class="filters-container"> <div class="filters-container">
<sae-filters-group (selectionchange)="onSelectedChoicesChange" [appState]="appState"></sae-filters-group>
<sae-filters-group></sae-filters-group>
</div> </div>
</div> </div>
</main> </main>

View file

@ -1,4 +1,13 @@
.magic-text { :host {
#question_analysis {
sae-bot-talks {
top: -50px;
position: relative;
}
}
.magic-text {
color: #A86CFD; color: #A86CFD;
font-family: Barlow; font-family: Barlow;
font-size: 20px; font-size: 20px;
@ -10,12 +19,13 @@
font-size: 1.25em; font-size: 1.25em;
margin-left: 2px; margin-left: 2px;
} }
} }
#translation_request { #translation_request {
.helper { .helper {
padding-left: 2.65vw; padding-left: 2.65vw;
padding-bottom: 16px; padding-bottom: 16px;
} }
} }
}

View file

@ -4,6 +4,8 @@ import {FiltersGroup} from 'sae-lib/filters/filters-group/filters-group';
import {BottomNavigation} from '../../shared/navigation/bottom-navigation/bottom-navigation'; import {BottomNavigation} from '../../shared/navigation/bottom-navigation/bottom-navigation';
import {FeedbackButton} from 'sae-lib/buttons/feedback-button/feedback-button'; import {FeedbackButton} from 'sae-lib/buttons/feedback-button/feedback-button';
import {BotTalks} from 'sae-lib/chatbot/bot-talks/bot-talks'; import {BotTalks} from 'sae-lib/chatbot/bot-talks/bot-talks';
import {Store} from '@ngrx/store';
import {StateInterface} from '../../redux/reducers';
@Component({ @Component({
@ -20,4 +22,20 @@ import {BotTalks} from 'sae-lib/chatbot/bot-talks/bot-talks';
}) })
export class Main { export class Main {
public appState: any = {};
constructor(private store: Store<StateInterface>) {
this.store.select(state => state.app).subscribe(app => {
this.appState = app;
});
}
onSelectedChoicesChange(e: any) {
console.log('onSelectedChoicesChange', e);
}
onAvailableChoicesChange(e: any) {
console.log('onSelectedChoicesChange', e);
}
} }

View file

@ -11,8 +11,8 @@ export const initialState: StateInterface = {
toText: "", toText: "",
filters: { filters: {
engineType: { engineType: {
availableList: {}, availableList: ['choix 1'],
selectedList: {} selectedList: ['choix 2']
}, },
findings: { findings: {
availableList: {}, availableList: {},

View file

@ -66,8 +66,8 @@ export type Theme = 'light' | 'dark';
export type Lang = 'fr_FR' | 'en_US'; export type Lang = 'fr_FR' | 'en_US';
export type SelectFilterType = { export type SelectFilterType = {
availableList: object; availableList: any;
selectedList: object; selectedList: any;
} }
export type technicalManualType = { export type technicalManualType = {