2018-09-18 18:20:26 +00:00
|
|
|
import { IVocab } from "../models/vocab";
|
|
|
|
import { IUser } from "../models/user";
|
2018-09-19 14:39:02 +00:00
|
|
|
import { ILevel } from "../models/level";
|
|
|
|
import { IReviewMetadata, IReviewCard } from "../models/review";
|
2018-09-18 18:20:26 +00:00
|
|
|
|
2018-09-18 16:06:08 +00:00
|
|
|
export const SET_DRAWER = "SET_DRAWER";
|
|
|
|
export function setDrawer(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: SET_DRAWER,
|
|
|
|
show: state,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SET_DRAWER_BUTTON = "SET_DRAWER_BUTTON";
|
|
|
|
export function setDrawerButton(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: SET_DRAWER_BUTTON,
|
|
|
|
show: state,
|
|
|
|
};
|
|
|
|
};
|
2018-09-18 16:59:15 +00:00
|
|
|
|
|
|
|
export const LOGIN_SET_SNACKBAR = "LOGIN_SET_SNACKBAR";
|
|
|
|
export function setLoginSnackbar(visibility: boolean, msg: string = "") {
|
|
|
|
return {
|
|
|
|
type: LOGIN_SET_SNACKBAR,
|
|
|
|
show: visibility,
|
|
|
|
msg,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LOGIN_SET_LOADING = "LOGIN_SET_LOADING";
|
|
|
|
export function setLoginLoading(visibility: boolean) {
|
|
|
|
return {
|
|
|
|
type: LOGIN_SET_LOADING,
|
|
|
|
show: visibility,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SET_AUTHENTICATED = "SET_AUTHENTICATED";
|
|
|
|
export function setAuthenticated(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: SET_AUTHENTICATED,
|
|
|
|
status: state,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export const SET_USER = "SET_USER";
|
|
|
|
export function setUser(user: IUser) {
|
|
|
|
return {
|
|
|
|
type: SET_USER,
|
|
|
|
user,
|
|
|
|
};
|
|
|
|
}
|
2018-09-18 18:20:26 +00:00
|
|
|
|
|
|
|
export const LEVEL_SET_REVIEW = "LEVEL_SET_REVIEW";
|
|
|
|
export function setLevelReview(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: LEVEL_SET_REVIEW,
|
|
|
|
state,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LEVEL_SET_LOOKEDAT = "LEVEL_SET_LOOKEDAT";
|
|
|
|
export function setLevelLookedAt(ids: number[]) {
|
|
|
|
return {
|
|
|
|
type: LEVEL_SET_REVIEW,
|
|
|
|
lookedAt: ids,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LEVEL_SET_CUR_VOCAB = "LEVEL_SET_CUR_VOCAB";
|
|
|
|
export function setLevelCurrentVocab(vocab: IVocab) {
|
|
|
|
return {
|
|
|
|
type: LEVEL_SET_CUR_VOCAB,
|
|
|
|
vocab,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LEVEL_SET_VOCAB = "LEVEL_SET_VOCAB";
|
|
|
|
export function setLevelVocab(vocab: IVocab[]) {
|
|
|
|
return {
|
|
|
|
type: LEVEL_SET_VOCAB,
|
|
|
|
vocab,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const LEVEL_SET_LOADING = "LEVEL_SET_LOADING";
|
|
|
|
export function setLevelLoading(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: LEVEL_SET_LOADING,
|
|
|
|
state,
|
|
|
|
};
|
|
|
|
};
|
2018-09-19 14:39:02 +00:00
|
|
|
|
|
|
|
export const SET_LEVELS = "SET_LEVELS";
|
|
|
|
export function setLevels(levels: ILevel[]) {
|
|
|
|
return {
|
|
|
|
type: SET_LEVELS,
|
|
|
|
levels,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const REVIEW_SET_POPOVER = "REVIEW_SET_POPOVER";
|
|
|
|
export function setReviewPopover(state: boolean, text: string, color: string) {
|
|
|
|
return {
|
|
|
|
type: REVIEW_SET_POPOVER,
|
|
|
|
state,
|
|
|
|
text,
|
|
|
|
color,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const REVIEW_SET_LOADING = "REVIEW_SET_LOADING";
|
|
|
|
export function setReviewLoading(state: boolean) {
|
|
|
|
return {
|
|
|
|
type: REVIEW_SET_LOADING,
|
|
|
|
state,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SET_LAST_REVIEW = "SET_LAST_REVIEW";
|
|
|
|
export function setLastReview(metadata: IReviewMetadata) {
|
|
|
|
return {
|
|
|
|
type: SET_LAST_REVIEW,
|
|
|
|
metadata,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
export const SET_REVIEW = "SET_REVIEW";
|
|
|
|
export function setReview(current: IReviewCard, meta: IReviewMetadata) {
|
|
|
|
return {
|
|
|
|
type: SET_REVIEW,
|
|
|
|
current,
|
|
|
|
meta,
|
|
|
|
};
|
|
|
|
};
|