Skip to content
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

Staging #1091

Merged
merged 4 commits into from
Dec 15, 2023
Merged

Staging #1091

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
2 changes: 2 additions & 0 deletions src/api/i18n.js
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,7 @@ export const stringsToTranslate = [
"has linked field",
"Help",
"here",
"Hide dashes",
"Hiding sentences",
"Human settlement",
"id",
Expand Down Expand Up @@ -569,6 +570,7 @@ export const stringsToTranslate = [
"No authors found",
"No background tasks",
"No coordinate data",
"No data.",
"No data for cognate analysis",
"No data found for analysis, please select another dictionary",
"No entries",
Expand Down
12 changes: 6 additions & 6 deletions src/components/CorporaView/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ import { openModal } from "ducks/modals";
import {
addLexicalEntry,
resetEntriesSelection,
resetSortByField,
resetOrderedSortByField,
selectLexicalEntry,
setSortByField
setOrderedSortByField
} from "ducks/perspective";
import TranslationContext from "Layout/TranslationContext";
import { compositeIdToString as id2str } from "utils/compositeId";
Expand Down Expand Up @@ -1006,18 +1006,18 @@ P.defaultProps = {

const PerspectiveView = compose(
connect(
({ user, perspective: { sortByField, createdEntries, selectedEntries } }) => ({
({ user, perspective: { orderedSortByField, createdEntries, selectedEntries } }) => ({
user,
sortByField,
sortByField: orderedSortByField,
createdEntries,
selectedEntries
}),
dispatch =>
bindActionCreators(
{
addLexicalEntry,
setSortByField,
resetSortByField,
setSortByField: setOrderedSortByField,
resetSortByField: resetOrderedSortByField,
selectLexicalEntry,
resetEntriesSelection,
openModal
Expand Down
24 changes: 23 additions & 1 deletion src/ducks/perspective.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export const SET = "@data/perspective/SET";
export const SET_FILTER = "@data/perspective/SET_FILTER";
export const SET_SORT_MODE = "@data/perspective/SET_SORT_MODE";
export const RESET_SORT_MODE = "@data/perspective/RESET_SORT_MODE";
export const SET_ORDERED_SORT_MODE = "@data/perspective/SET_ORDERED_SORT_MODE";
export const RESET_ORDERED_SORT_MODE = "@data/perspective/RESET_ORDERED_SORT_MODE";
export const ADD_LEXICAL_ENTRY = "@data/perspective/ADD_LEXICAL_ENTRY";
export const SELECT_LEXICAL_ENTRY = "@data/perspective/SELECT_LEXICAL_ENTRY";
export const RESET_ENTRIES_SELECTION = "@data/perspective/RESET_ENTRIES_SELECTION";
Expand All @@ -30,7 +32,7 @@ function filter(state = "", action = {}) {
}
}

function sortByField(state = { field: null, order: "a" }, { type, payload }) {
function sortByField(state = { field: [66, 10], order: "a" }, { type, payload }) {
switch (type) {
case SET_SORT_MODE:
return payload;
Expand All @@ -41,6 +43,17 @@ function sortByField(state = { field: null, order: "a" }, { type, payload }) {
}
}

function orderedSortByField(state = { field: null, order: "a" }, { type, payload }) {
switch (type) {
case SET_ORDERED_SORT_MODE:
return payload;
case RESET_ORDERED_SORT_MODE:
return null;
default:
return state;
}
}

function createdEntries(state = [], { type, payload }) {
switch (type) {
case ADD_LEXICAL_ENTRY:
Expand All @@ -65,6 +78,7 @@ export default combineReducers({
params,
filter,
sortByField,
orderedSortByField,
createdEntries,
selectedEntries
});
Expand Down Expand Up @@ -97,6 +111,14 @@ export function resetSortByField() {
return { type: RESET_SORT_MODE, payload: null };
}

export function setOrderedSortByField(field, order) {
return { type: SET_ORDERED_SORT_MODE, payload: { field, order } };
}

export function resetOrderedSortByField() {
return { type: RESET_ORDERED_SORT_MODE, payload: null };
}

export function addLexicalEntry(entry) {
return { type: ADD_LEXICAL_ENTRY, payload: entry };
}
Expand Down