try share target

This commit is contained in:
lingdocs 2021-08-27 00:37:47 +04:00
parent d4a21059ea
commit b2e027ce3e
2 changed files with 18 additions and 2 deletions

View File

@ -36,5 +36,12 @@
"display": "standalone",
"theme_color": "#333333",
"background_color": "#f9f9f9",
"start_url": "."
"start_url": ".",
"share_target": {
"action": "/share-target",
"method": "GET",
"params": {
"text": "text"
}
}
}

View File

@ -86,7 +86,7 @@ if (prod) {
}
const possibleLandingPages = [
"/", "/about", "/settings", "/word", "/account", "/new-entries",
"/", "/about", "/settings", "/word", "/account", "/new-entries", "/share-target",
];
const editorOnlyPages = [
"/edit", "/review-tasks",
@ -168,6 +168,15 @@ class App extends Component<RouteComponentProps, State> {
this.props.history.replace("/");
}
}
if (this.props.location.pathname === "/share-target") {
if (this.state.options.language === "English") {
this.handleOptionsUpdate({ type: "toggleLanguage" });
}
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const searchString = urlParams.get("text") || "";
this.handleSearchValueChange(searchString);
}
if (this.props.location.pathname === "/new-entries") {
this.setState({
results: dictionary.getNewWordsThisMonth(),