Skip to content

feat: Improvements considering validation phase #71

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Apr 30, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion assets/css/_banner.scss
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@
}

span:last-child {
color: $PRIMARY_COLOR_LIGHT;
color: $PRIMARY_COLOR;
font-weight: bold;
display: flex;
align-items: center;
position: relative;
Expand Down
2 changes: 1 addition & 1 deletion assets/css/_container.scss
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,9 @@

.input-wrapper--with-icon {
position: relative;
height: 40px;
width: 100%;
max-width: 400px;
height: 45px;

input {
max-width: 400px;
Expand Down
8 changes: 4 additions & 4 deletions assets/css/_markdown-style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
}

p {
margin-bottom: 25px;
margin-top: 25px;
margin-bottom: 15px;
margin-top: 15px;

> code, .title-ref {
background-color: lighten($TERNARY_COLOR, 25);
Expand All @@ -44,8 +44,8 @@
}

pre {
margin-top: 30px;
margin-bottom: 30px;
margin-top: 15px;
margin-bottom: 15px;
overflow-x: scroll;
background-color: lighten($GREY, 63);
padding: 20px;
Expand Down
31 changes: 30 additions & 1 deletion assets/css/_panel.scss
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,18 @@
border-radius: 4px;
background-color: white;
@include box-shadow($SHADOW);
overflow: hidden;

&::before{
content: "";
border-radius: 4px;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
@include box-shadow($SHADOW_EXPANDED);
opacity: 0;
}

.panel-wrapper {
height: calc(100% - 50px);
Expand All @@ -28,3 +39,21 @@
}
}
}

.animatePanel {
&::before {
animation: bounce infinite ease;
animation-duration: 1.5s;
}
}

@keyframes bounce {
from, 50%, to {
opacity: 0;
}

25%, 75% {
opacity: 1;
}
}

9 changes: 6 additions & 3 deletions assets/css/_tag-selecter.scss
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,19 @@
list-style-type: none;
padding: 0 20px 0 20px;
max-height: 0;
overflow-y: scroll;
overflow-x: hidden;
overflow: hidden;
@include transitionHelper(max-height .4s ease);

&.active {
max-height: 300px;
max-height: inherit;
}

}

input {
width: 100%;
}

li {
margin-bottom: 10px;
}
Expand Down
1 change: 1 addition & 0 deletions assets/css/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ $LINEAR_GRADIENT_ORANGE: linear-gradient(to right, #eea849, #f46b45);
*/

$SHADOW: 0 0 15px 0 rgba(0, 0, 0, 0.15);
$SHADOW_EXPANDED: 0 0 30px 0 rgba(0, 0, 0, 0.24);
$SHADOW_BOTTOM:0 12px 15px -15px rgba(0, 0, 0, 0.15);

/*
Expand Down
13 changes: 10 additions & 3 deletions assets/css/form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ input:not([type=radio]), textarea, .custom-select {
outline: none;
background-color: transparent;
font-family: $Montserrat;
font-weight: lighter;
font-weight: normal;
font-size: 0.75em;
}

Expand Down Expand Up @@ -95,10 +95,17 @@ input[type=file] {

input:not([type=radio]) {
padding-left: 50px;
font-weight: normal;
line-height: 3em;

font-size: 0.9em;
&::placeholder {
font-size: 1em;
}
}

svg {
width: 15px;
width: 20px;
position: absolute;
top: 50%;
left: 20px;
Expand Down Expand Up @@ -138,7 +145,7 @@ form {
Custom theme of textarea
*/

@include input-theme(primary-color, $PRIMARY_COLOR, $PRIMARY_COLOR_LIGHT);
@include input-theme(primary-color, $PRIMARY_COLOR, $PRIMARY_COLOR);
@include input-theme(secondary-color, $SECONDARY_COLOR, lighten($SECONDARY_COLOR, 10));
@include input-theme(ternary-color, $TERNARY_COLOR, lighten($TERNARY_COLOR, 10));
@include input-theme(grey, $GREY, lighten($GREY, 20));
30 changes: 30 additions & 0 deletions assets/js/tiptap/ListItem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Node } from 'tiptap'
import {splitListItem, liftListItem, sinkListItem, insertText, chainCommands} from 'tiptap-commands'

export default class ListItem extends Node {

get name() {
return 'list_item'
}

get schema() {
return {
content: 'paragraph block*',
defining: true,
draggable: false,
parseDOM: [
{ tag: 'li' },
],
toDOM: () => ['li', 0],
}
}

keys({ type } : any) {
return {
Enter: splitListItem(type),
Tab: chainCommands(sinkListItem(type), insertText(" ")),
"Shift-Tab": liftListItem(type)
};
}

}
2 changes: 1 addition & 1 deletion components/Editor/RichTextEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,6 @@
HorizontalRule,
OrderedList,
BulletList,
ListItem,
TodoItem,
TodoList,
Bold,
Expand All @@ -205,6 +204,7 @@
CodeBlockHighlight,
Placeholder
} from 'tiptap-extensions'
import ListItem from "~/assets/js/tiptap/ListItem"
import {Component, Prop, Ref, Vue} from "vue-property-decorator";

@Component({
Expand Down
62 changes: 57 additions & 5 deletions components/Exercise/ExercisesPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
<section id="ExercisesPanel" class="exercises-wrapper">
<header ref="headerExercise">
<div class="header-wrapper">
<h1>
Résultats de recherche
<span v-if="!isEmptySearchModel"> - {{searchModel}}</span>
</h1>

<div class="input-wrapper--with-icon input-with--enter-icon">
<Icon type="search"/>
<input ref="inputText" class="input--primary-color" type="text" @input="resetIfEmpty" @keydown.enter="debounceInput"
placeholder="Rechercher">
</div>

<div class="results">
{{nbOfResults}} résultats - <span @click.self="reset" class="init">réinitialiser la recherche</span>
Expand Down Expand Up @@ -39,11 +41,13 @@
import PreviewExercise from '~/components/Exercise/PreviewExercise.vue'
import IntersectMixins from "~/components/Mixins/IntersectMixins.vue";
import {Exercise, SelectedTag, TagLabelObjectEmitted, TagState} from "~/types";
import Icon from "~/components/Symbols/Icon.vue";

const ratio = .2;

@Component({
components: {
Icon,
Tag,
PreviewExercise
}
Expand All @@ -52,6 +56,9 @@
@Ref() headerExercise!: HTMLElement;
@Ref() bodyExercise!: HTMLElement;
@Ref() anchor!: Element;
@Ref() inputText!: HTMLInputElement;



intersectionObserverOptions: IntersectionObserverInit = {
root: null,
Expand Down Expand Up @@ -188,7 +195,38 @@
}
});

this.$emit('reset');
this.resetInput();
}

debounceInput(e: any) {
const value = e.target.value;
this.$accessor.exercises.fetch({data: {title: value}});
this.$accessor.historical.addHistorical({
tags: this.$accessor.tags.selectedTags,
title: value,
vote: this.$accessor.exercises.search_criterion.vote
})
}

resetInput() {
this.inputText.value = ""
}

resetIfEmpty(e:any) {
const value:string = e.target.value;

if(value === '') {
this.$accessor.exercises.fetch({data: {title: ""}});
}
}

refreshInput() {
this.inputText.value = this.$accessor.exercises.search_criterion.title || '';
}

setInput() {
const title = this.$accessor.exercises.search_criterion.title;
this.inputText.value = !!title ? title : '';
}

handleIntersect(entries: IntersectionObserverEntry[]) {
Expand All @@ -202,6 +240,10 @@
targets(): Element[] {
return [this.anchor]
}

mounted() {
this.setInput();
}
}
</script>

Expand Down Expand Up @@ -236,6 +278,16 @@
}
}

.input-wrapper--with-icon {
width: 100%;
max-width: 400px;
margin-bottom: 15px;

input {
width: 100%;
}
}

.exercises-content-wrapper {
overflow-y: scroll;
max-height: calc(100% - 66px);
Expand Down
3 changes: 1 addition & 2 deletions components/Gestion/FavoriteForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,8 @@

// Tags validation
const tags: number[] = this.selectedTags.map((tag: SelectedTag) => tag.tag_id);
const isTagsValid = tags.length !== 0;

if (isValid && isTagsValid) {
if (isValid) {

const request: UpdateConfigurationRequest | CreateConfigurationRequest = {
name: this.form.name,
Expand Down
8 changes: 1 addition & 7 deletions components/Menu.vue
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,7 @@
background-color: rgba(white, .2);
@include transitionHelper(background-color .3s ease)
}

&.cta-link-with-arrow:after {
content: url("~assets/logo/arrow.svg");
position: absolute;
right: $PADDING_MENU/1.5;

}


&.cta-animate {
@include animation(blink-background 1.5s linear)
Expand Down
4 changes: 2 additions & 2 deletions components/Panel/Item/DetailsPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
* The exercise containing details, tags,...
*/
@Prop({type: Object, required: true}) exercise!: Exercise;

/**
* Classify all tags by categories and sorts the categories
*/
Expand Down Expand Up @@ -80,7 +80,7 @@
@import "assets/css/font";

#DetailsPanel {

position: relative;
padding: 20px;

h4 {
Expand Down
1 change: 1 addition & 0 deletions components/Panel/Item/ExercisesCheckPanel.vue
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@

#ExercisesCheckPanel {
padding: 20px 0;
position: relative;

.results {
padding: 0 20px;
Expand Down
Loading