Skip to content

Commit 8b81060

Browse files
authored
Merge pull request #71 from SourceCodeOER/improvements
feat: Improvements considering validation phase
2 parents 4acdcae + f1e6de4 commit 8b81060

33 files changed

+252
-96
lines changed

assets/css/_banner.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,8 @@
5757
}
5858

5959
span:last-child {
60-
color: $PRIMARY_COLOR_LIGHT;
60+
color: $PRIMARY_COLOR;
61+
font-weight: bold;
6162
display: flex;
6263
align-items: center;
6364
position: relative;

assets/css/_container.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@
7474

7575
.input-wrapper--with-icon {
7676
position: relative;
77-
height: 40px;
7877
width: 100%;
7978
max-width: 400px;
79+
height: 45px;
8080

8181
input {
8282
max-width: 400px;

assets/css/_markdown-style.scss

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
}
3232

3333
p {
34-
margin-bottom: 25px;
35-
margin-top: 25px;
34+
margin-bottom: 15px;
35+
margin-top: 15px;
3636

3737
> code, .title-ref {
3838
background-color: lighten($TERNARY_COLOR, 25);
@@ -44,8 +44,8 @@
4444
}
4545

4646
pre {
47-
margin-top: 30px;
48-
margin-bottom: 30px;
47+
margin-top: 15px;
48+
margin-bottom: 15px;
4949
overflow-x: scroll;
5050
background-color: lighten($GREY, 63);
5151
padding: 20px;

assets/css/_panel.scss

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,18 @@
1111
border-radius: 4px;
1212
background-color: white;
1313
@include box-shadow($SHADOW);
14-
overflow: hidden;
14+
15+
&::before{
16+
content: "";
17+
border-radius: 4px;
18+
position: absolute;
19+
top: 0;
20+
left: 0;
21+
width: 100%;
22+
height: 100%;
23+
@include box-shadow($SHADOW_EXPANDED);
24+
opacity: 0;
25+
}
1526

1627
.panel-wrapper {
1728
height: calc(100% - 50px);
@@ -28,3 +39,21 @@
2839
}
2940
}
3041
}
42+
43+
.animatePanel {
44+
&::before {
45+
animation: bounce infinite ease;
46+
animation-duration: 1.5s;
47+
}
48+
}
49+
50+
@keyframes bounce {
51+
from, 50%, to {
52+
opacity: 0;
53+
}
54+
55+
25%, 75% {
56+
opacity: 1;
57+
}
58+
}
59+

assets/css/_tag-selecter.scss

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,19 @@
1010
list-style-type: none;
1111
padding: 0 20px 0 20px;
1212
max-height: 0;
13-
overflow-y: scroll;
14-
overflow-x: hidden;
13+
overflow: hidden;
1514
@include transitionHelper(max-height .4s ease);
1615

1716
&.active {
18-
max-height: 300px;
17+
max-height: inherit;
1918
}
2019

2120
}
2221

22+
input {
23+
width: 100%;
24+
}
25+
2326
li {
2427
margin-bottom: 10px;
2528
}

assets/css/_variables.scss

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ $LINEAR_GRADIENT_ORANGE: linear-gradient(to right, #eea849, #f46b45);
6363
*/
6464

6565
$SHADOW: 0 0 15px 0 rgba(0, 0, 0, 0.15);
66+
$SHADOW_EXPANDED: 0 0 30px 0 rgba(0, 0, 0, 0.24);
6667
$SHADOW_BOTTOM:0 12px 15px -15px rgba(0, 0, 0, 0.15);
6768

6869
/*

assets/css/form.scss

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ input:not([type=radio]), textarea, .custom-select {
2525
outline: none;
2626
background-color: transparent;
2727
font-family: $Montserrat;
28-
font-weight: lighter;
28+
font-weight: normal;
2929
font-size: 0.75em;
3030
}
3131

@@ -95,10 +95,17 @@ input[type=file] {
9595

9696
input:not([type=radio]) {
9797
padding-left: 50px;
98+
font-weight: normal;
99+
line-height: 3em;
100+
101+
font-size: 0.9em;
102+
&::placeholder {
103+
font-size: 1em;
104+
}
98105
}
99106

100107
svg {
101-
width: 15px;
108+
width: 20px;
102109
position: absolute;
103110
top: 50%;
104111
left: 20px;
@@ -138,7 +145,7 @@ form {
138145
Custom theme of textarea
139146
*/
140147

141-
@include input-theme(primary-color, $PRIMARY_COLOR, $PRIMARY_COLOR_LIGHT);
148+
@include input-theme(primary-color, $PRIMARY_COLOR, $PRIMARY_COLOR);
142149
@include input-theme(secondary-color, $SECONDARY_COLOR, lighten($SECONDARY_COLOR, 10));
143150
@include input-theme(ternary-color, $TERNARY_COLOR, lighten($TERNARY_COLOR, 10));
144151
@include input-theme(grey, $GREY, lighten($GREY, 20));

assets/js/tiptap/ListItem.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { Node } from 'tiptap'
2+
import {splitListItem, liftListItem, sinkListItem, insertText, chainCommands} from 'tiptap-commands'
3+
4+
export default class ListItem extends Node {
5+
6+
get name() {
7+
return 'list_item'
8+
}
9+
10+
get schema() {
11+
return {
12+
content: 'paragraph block*',
13+
defining: true,
14+
draggable: false,
15+
parseDOM: [
16+
{ tag: 'li' },
17+
],
18+
toDOM: () => ['li', 0],
19+
}
20+
}
21+
22+
keys({ type } : any) {
23+
return {
24+
Enter: splitListItem(type),
25+
Tab: chainCommands(sinkListItem(type), insertText(" ")),
26+
"Shift-Tab": liftListItem(type)
27+
};
28+
}
29+
30+
}

components/Editor/RichTextEditor.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@
192192
HorizontalRule,
193193
OrderedList,
194194
BulletList,
195-
ListItem,
196195
TodoItem,
197196
TodoList,
198197
Bold,
@@ -205,6 +204,7 @@
205204
CodeBlockHighlight,
206205
Placeholder
207206
} from 'tiptap-extensions'
207+
import ListItem from "~/assets/js/tiptap/ListItem"
208208
import {Component, Prop, Ref, Vue} from "vue-property-decorator";
209209
210210
@Component({

components/Exercise/ExercisesPanel.vue

Lines changed: 57 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
<section id="ExercisesPanel" class="exercises-wrapper">
33
<header ref="headerExercise">
44
<div class="header-wrapper">
5-
<h1>
6-
Résultats de recherche
7-
<span v-if="!isEmptySearchModel"> - {{searchModel}}</span>
8-
</h1>
5+
6+
<div class="input-wrapper--with-icon input-with--enter-icon">
7+
<Icon type="search"/>
8+
<input ref="inputText" class="input--primary-color" type="text" @input="resetIfEmpty" @keydown.enter="debounceInput"
9+
placeholder="Rechercher">
10+
</div>
911

1012
<div class="results">
1113
{{nbOfResults}} résultats - <span @click.self="reset" class="init">réinitialiser la recherche</span>
@@ -39,11 +41,13 @@
3941
import PreviewExercise from '~/components/Exercise/PreviewExercise.vue'
4042
import IntersectMixins from "~/components/Mixins/IntersectMixins.vue";
4143
import {Exercise, SelectedTag, TagLabelObjectEmitted, TagState} from "~/types";
44+
import Icon from "~/components/Symbols/Icon.vue";
4245
4346
const ratio = .2;
4447
4548
@Component({
4649
components: {
50+
Icon,
4751
Tag,
4852
PreviewExercise
4953
}
@@ -52,6 +56,9 @@
5256
@Ref() headerExercise!: HTMLElement;
5357
@Ref() bodyExercise!: HTMLElement;
5458
@Ref() anchor!: Element;
59+
@Ref() inputText!: HTMLInputElement;
60+
61+
5562
5663
intersectionObserverOptions: IntersectionObserverInit = {
5764
root: null,
@@ -188,7 +195,38 @@
188195
}
189196
});
190197
191-
this.$emit('reset');
198+
this.resetInput();
199+
}
200+
201+
debounceInput(e: any) {
202+
const value = e.target.value;
203+
this.$accessor.exercises.fetch({data: {title: value}});
204+
this.$accessor.historical.addHistorical({
205+
tags: this.$accessor.tags.selectedTags,
206+
title: value,
207+
vote: this.$accessor.exercises.search_criterion.vote
208+
})
209+
}
210+
211+
resetInput() {
212+
this.inputText.value = ""
213+
}
214+
215+
resetIfEmpty(e:any) {
216+
const value:string = e.target.value;
217+
218+
if(value === '') {
219+
this.$accessor.exercises.fetch({data: {title: ""}});
220+
}
221+
}
222+
223+
refreshInput() {
224+
this.inputText.value = this.$accessor.exercises.search_criterion.title || '';
225+
}
226+
227+
setInput() {
228+
const title = this.$accessor.exercises.search_criterion.title;
229+
this.inputText.value = !!title ? title : '';
192230
}
193231
194232
handleIntersect(entries: IntersectionObserverEntry[]) {
@@ -202,6 +240,10 @@
202240
targets(): Element[] {
203241
return [this.anchor]
204242
}
243+
244+
mounted() {
245+
this.setInput();
246+
}
205247
}
206248
</script>
207249

@@ -236,6 +278,16 @@
236278
}
237279
}
238280
281+
.input-wrapper--with-icon {
282+
width: 100%;
283+
max-width: 400px;
284+
margin-bottom: 15px;
285+
286+
input {
287+
width: 100%;
288+
}
289+
}
290+
239291
.exercises-content-wrapper {
240292
overflow-y: scroll;
241293
max-height: calc(100% - 66px);

components/Gestion/FavoriteForm.vue

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,9 +81,8 @@
8181
8282
// Tags validation
8383
const tags: number[] = this.selectedTags.map((tag: SelectedTag) => tag.tag_id);
84-
const isTagsValid = tags.length !== 0;
8584
86-
if (isValid && isTagsValid) {
85+
if (isValid) {
8786
8887
const request: UpdateConfigurationRequest | CreateConfigurationRequest = {
8988
name: this.form.name,

components/Menu.vue

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -276,13 +276,7 @@
276276
background-color: rgba(white, .2);
277277
@include transitionHelper(background-color .3s ease)
278278
}
279-
280-
&.cta-link-with-arrow:after {
281-
content: url("~assets/logo/arrow.svg");
282-
position: absolute;
283-
right: $PADDING_MENU/1.5;
284-
285-
}
279+
286280
287281
&.cta-animate {
288282
@include animation(blink-background 1.5s linear)

components/Panel/Item/DetailsPanel.vue

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
* The exercise containing details, tags,...
4242
*/
4343
@Prop({type: Object, required: true}) exercise!: Exercise;
44-
44+
4545
/**
4646
* Classify all tags by categories and sorts the categories
4747
*/
@@ -80,7 +80,7 @@
8080
@import "assets/css/font";
8181
8282
#DetailsPanel {
83-
83+
position: relative;
8484
padding: 20px;
8585
8686
h4 {

components/Panel/Item/ExercisesCheckPanel.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@
107107
108108
#ExercisesCheckPanel {
109109
padding: 20px 0;
110+
position: relative;
110111
111112
.results {
112113
padding: 0 20px;

0 commit comments

Comments
 (0)