Skip to content

Commit

Permalink
fix: prettier and remove .env (#17)
Browse files Browse the repository at this point in the history
* remove .env

* prettier:fix
  • Loading branch information
wenhwang97 authored Dec 13, 2023
1 parent 87e29bf commit 0a83fb4
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 18 deletions.
9 changes: 0 additions & 9 deletions .env

This file was deleted.

7 changes: 6 additions & 1 deletion src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { IonApp, IonContent, IonRouterOutlet, setupIonicReact } from "@ionic/react";
import {
IonApp,
IonContent,
IonRouterOutlet,
setupIonicReact,
} from "@ionic/react";
import { IonReactRouter } from "@ionic/react-router";
import { Redirect, Route } from "react-router-dom";

Expand Down
33 changes: 25 additions & 8 deletions src/pages/Discover.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,15 @@ const token = import.meta.env.VITE_STRAPY_TOKEN;
const apiKey = import.meta.env.VITE_ELEVEN_LABS_API_KEY;

const Discover: React.FC = () => {
const [selectedVoiceId, setSelectedVoiceId] = useState("21m00Tcm4TlvDq8ikWAM");
const [selectedVoiceId, setSelectedVoiceId] = useState(
"21m00Tcm4TlvDq8ikWAM"
);
const [isExpandedArray, setIsExpandedArray] = useState<any>([]);
const [articles, setArticles] = useState<any>([]);
const [usedVoiceIds, setUsedVoicesIds] = useState<any>(["D38z5RcWu1voky8WS1ja", "21m00Tcm4TlvDq8ikWAM"]);
const [usedVoiceIds, setUsedVoicesIds] = useState<any>([
"D38z5RcWu1voky8WS1ja",
"21m00Tcm4TlvDq8ikWAM",
]);
const [usedVoices, setUsedVoices] = useState<any>([]);
const [filteredArticles, setFilteredArticles] = useState<any>([]);
const [searchText, setSearchText] = useState("");
Expand Down Expand Up @@ -54,7 +59,9 @@ const Discover: React.FC = () => {
})
.then((res) => res.json())
.then((resp) => {
const filteredVoices = resp.voices.filter((voice: any) => usedVoiceIds.includes(voice.voice_id));
const filteredVoices = resp.voices.filter((voice: any) =>
usedVoiceIds.includes(voice.voice_id)
);
setUsedVoices(filteredVoices);
console.log(filteredVoices);
});
Expand All @@ -77,7 +84,9 @@ const Discover: React.FC = () => {
};

const handlePlayPreview = () => {
const selectedVoice = usedVoices.find((voice: any) => voice.voice_id === selectedVoiceId);
const selectedVoice = usedVoices.find(
(voice: any) => voice.voice_id === selectedVoiceId
);
if (selectedVoice) {
const audio = new Audio(selectedVoice.preview_url);
audio.play();
Expand All @@ -100,7 +109,9 @@ const Discover: React.FC = () => {
<div className="pt-24">
<div className="p-12 z-50">
<IonText color="dark">
<h1 className="text-3xl font-bold font-sans mb-4 md:mb-6 md:text-4xl">Informative Mental Health</h1>
<h1 className="text-3xl font-bold font-sans mb-4 md:mb-6 md:text-4xl">
Informative Mental Health
</h1>
</IonText>
<div className="max-w-lg">
<IonText
Expand All @@ -110,8 +121,9 @@ const Discover: React.FC = () => {
fontWeight: 500,
}}
>
Explore our collection of informative mental health resources designed to help teens navigate
their emotional well-being and find support.
Explore our collection of informative mental health
resources designed to help teens navigate their emotional
well-being and find support.
</IonText>
</div>
</div>
Expand Down Expand Up @@ -195,7 +207,12 @@ const Discover: React.FC = () => {
<IonButton size="small" color="warning" shape="round">
<IonIcon icon={informationCircleOutline} />
</IonButton>
<IonButton size="small" color="success" shape="round" onClick={handlePlayPreview}>
<IonButton
size="small"
color="success"
shape="round"
onClick={handlePlayPreview}
>
<IonIcon icon={play} />
</IonButton>
<select
Expand Down

0 comments on commit 0a83fb4

Please sign in to comment.