diff --git a/src/pages/ListCognates/index.js b/src/pages/ListCognates/index.js index b390da34..545d0d66 100644 --- a/src/pages/ListCognates/index.js +++ b/src/pages/ListCognates/index.js @@ -1,7 +1,6 @@ import { connect } from "react-redux"; -import { Button, Checkbox, Dimmer, Icon, Input, Label, List, Loader, Message, Segment } from "semantic-ui-react"; +import { Button, Checkbox, Dimmer, Icon, Input, Label, Loader, Message, Segment } from "semantic-ui-react"; import { gql, useMutation } from "@apollo/client"; -import { compose } from "recompose"; import React, { useContext, useState, useEffect } from "react"; import TranslationContext from "Layout/TranslationContext"; @@ -9,29 +8,38 @@ import TranslationContext from "Layout/TranslationContext"; const cognatesSummaryMutation = gql` mutation cognatesSummary ( $onlyInToc: Boolean! - $languageOffset: Int - $languageLimit: Int + $languageGroup: String + $languageTitle: String + $perspectiveOffset: Int + $perspectiveLimit: Int $debugFlag: Boolean ) { cognates_summary( only_in_toc: $onlyInToc - offset: $languageOffset - limit: $languageLimit + group: $languageGroup + title: $languageTitle + offset: $perspectiveOffset + limit: $perspectiveLimit debug_flag: $debugFlag ) { json_url language_list + message triumph } } `; -const ListCognates = ({user}) => { +const ListCognates = connect(state => state.user)(({user}) => { const [onlyInToc, setOnlyInToc] = useState(false); const [cleanResult, setCleanResult] = useState(false); - const [languageOffset, setLanguageOffset] = useState(0); - const [languageLimit, setLanguageLimit] = useState(10); + const [languageGroup, setLanguageGroup] = useState(null); + const [languageTitle, setLanguageTitle] = useState(null); + const [perspectiveOffset, setPerspectiveOffset] = useState(0); + const [perspectiveLimit, setPerspectiveLimit] = useState(10); + const [shownParentGroup, showParentGroup] = useState(false); + const [shownLanguagePosition, showLanguagePosition] = useState(false); const [getCognatesSummary, { data, error, loading }] = useMutation(cognatesSummaryMutation); useEffect(() => setCleanResult(false), [loading, data]); @@ -39,12 +47,29 @@ const ListCognates = ({user}) => { const debugFlag = false; + const runMutation = () => { + getCognatesSummary( + { variables: + { + onlyInToc, + languageGroup, + languageTitle, + perspectiveOffset, + perspectiveLimit, + debugFlag + } + } + ); + } + + const fail = !data || !data.cognates_summary.triumph; + return (
{getTranslation("This page is available for administrator only")}
+{getTranslation("This page is available for registered users only")}
{error.message}
{data.cognates_summary.message}
+