diff --git a/functions/src/publish.ts b/functions/src/publish.ts
index e66835d..463b8b3 100644
--- a/functions/src/publish.ts
+++ b/functions/src/publish.ts
@@ -227,8 +227,10 @@ async function upload(content: Buffer | string, filename: string) {
metadata: {
contentType: isBuffer
? "application/octet-stream"
- : filename.slice(-5) === ".json"
+ : filename.endsWith(".json")
? "application/json"
+ : filename.endsWith(".xml")
+ ? "application/xml"
: "text/plain; charset=UTF-8",
cacheControl: "no-cache",
},
@@ -274,14 +276,21 @@ async function uploadDictionaryToStorage(dictionary: T.Dictionary) {
}
function makeSitemap(dictionary: T.Dictionary): string {
+ const pages = [
+ ...["", "/about", "/settings", "/account", "/phrase-builder"],
+ ...dictionary.entries.map((x) => `/word?id=${x.ts}`),
+ ];
return `
- ${dictionary.entries.map(
- (entry) =>
- `
- https://dictionary.lingdocs.com/word?id=${entry.ts}
+ ${pages
+ .map(
+ (page) =>
+ `
+
+ https://dictionary.lingdocs.com${page}}
`
- )}
+ )
+ .join("")}
`;
}
diff --git a/website/src/components/Entry.tsx b/website/src/components/Entry.tsx
index c99a3f3..52032c5 100644
--- a/website/src/components/Entry.tsx
+++ b/website/src/components/Entry.tsx
@@ -36,9 +36,11 @@ function Entry({
data-testid="entry"
>
-
- {{ p: entry.p, f: entry.f }}
-
+
+
+ {{ p: entry.p, f: entry.f }}
+
+
{` `}
{entry.c}
{entry.a && !nonClickable && (
@@ -49,7 +51,9 @@ function Entry({
)}
- {entry.e}
+
+ {entry.e}
+
);
}
diff --git a/website/src/components/EntryAudioDisplay.tsx b/website/src/components/EntryAudioDisplay.tsx
new file mode 100644
index 0000000..0a46316
--- /dev/null
+++ b/website/src/components/EntryAudioDisplay.tsx
@@ -0,0 +1,32 @@
+import { Types as T, InlinePs } from "@lingdocs/ps-react";
+import { getAudioPath } from "./PlayStorageAudio";
+
+export function EntryAudioDisplay({
+ entry,
+ opts,
+}: {
+ entry: T.DictionaryEntry;
+ opts: T.TextOptions;
+}) {
+ if (!entry.a) {
+ return null;
+ }
+ return (
+
+
+ Listen to {{ p: entry.p, f: entry.f }}
+
+
+
+ );
+}
diff --git a/website/src/components/PlayStorageAudio.tsx b/website/src/components/PlayStorageAudio.tsx
index 30d696f..de8d62c 100644
--- a/website/src/components/PlayStorageAudio.tsx
+++ b/website/src/components/PlayStorageAudio.tsx
@@ -1,6 +1,10 @@
+export function getAudioPath(ts: number): string {
+ return `https://storage.lingdocs.com/audio/${ts}.mp3`;
+}
+
export default function playStorageAudio(ts: number, callback: () => void) {
if (!ts) return;
- let audio = new Audio(`https://storage.lingdocs.com/audio/${ts}.mp3`);
+ let audio = new Audio(getAudioPath(ts));
audio.addEventListener("ended", () => {
callback();
audio.remove();
diff --git a/website/src/screens/IsolatedEntry.tsx b/website/src/screens/IsolatedEntry.tsx
index 9e09392..c440f39 100644
--- a/website/src/screens/IsolatedEntry.tsx
+++ b/website/src/screens/IsolatedEntry.tsx
@@ -34,7 +34,7 @@ import { Modal } from "react-bootstrap";
import { getTextOptions } from "../lib/get-text-options";
import { entryFeeder } from "../lib/dictionary";
import { State, DictionaryAPI } from "../types/dictionary-types";
-import playStorageAudio from "../components/PlayStorageAudio";
+import { EntryAudioDisplay } from "../components/EntryAudioDisplay";
function IsolatedEntry({
state,
@@ -46,7 +46,6 @@ function IsolatedEntry({
isolateEntry: (ts: number) => void;
}) {
const [exploded, setExploded] = useState(false);
- const [playing, setPlaying] = useState(false);
const [editing, setEditing] = useState(false);
const [comment, setComment] = useState("");
const [editSubmitted, setEditSubmitted] = useState(false);
@@ -57,7 +56,6 @@ function IsolatedEntry({
setEditing(false);
setComment("");
setEditSubmitted(false);
- setPlaying(false);
}, [state]);
function flashClippedMessage(m: string) {
setShowClipped(m);
@@ -154,17 +152,14 @@ function IsolatedEntry({
navigator.clipboard.writeText(JSON.stringify(entry));
flashClippedMessage("entry data copied to clipboard");
}
- function handlePlayStorageAudio() {
- if (!entry) return;
- setPlaying(true);
- playStorageAudio(entry.ts, () => {
- setPlaying(false);
- });
- }
return (
{entry.p} - LingDocs Pashto Dictionary
+
@@ -177,13 +172,6 @@ function IsolatedEntry({
- {entry.a && (
-
-
-
- )}
setExploded((os) => !os)}
@@ -239,6 +227,7 @@ function IsolatedEntry({
+
{wordlistWord && (
<>
{hasAttachment(wordlistWord, "audio") && (