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

feat: settings view new frontend #231

Draft
wants to merge 2 commits into
base: feat/splitBackendAndFrontend
Choose a base branch
from
Draft
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
1 change: 1 addition & 0 deletions frontend/.env.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
API_URL=https://example.com
9 changes: 6 additions & 3 deletions frontend/astro.config.mjs
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
import { defineConfig } from "astro/config";
import node from "@astrojs/node";

import react from "@astrojs/react";

// https://astro.build/config
export default defineConfig({
site: "https://jojo.schibsted.com",
output: "server",
adapter: node({
mode: "standalone",
mode: "standalone"
}),
prefetch: {
prefetchAll: true,
prefetchAll: true
},
});
integrations: [react()]
});
191 changes: 191 additions & 0 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,14 @@
"dependencies": {
"@astrojs/check": "^0.3.3",
"@astrojs/node": "^7.0.2",
"@astrojs/react": "^3.0.10",
"@nanostores/react": "^0.7.2",
"@types/react": "^18.2.64",
"@types/react-dom": "^18.2.21",
"astro": "^4.0.7",
"nanostores": "^0.10.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.3.3",
"zod": "^3.22.4"
}
Expand Down
59 changes: 59 additions & 0 deletions frontend/src/components/Modal/LanguageSettings.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
import { useStore } from "@nanostores/react";
import { $modelSettings, cancelUpload, setSelectedLanguage } from "../../stores/FileStore";

const LanguageSettings = ({
languages,
setSettingTab,
files,
}: {
languages: string[];
setSettingTab: (tab: number) => void;
files: { files: File[] };

}) => {
const modelSettings = useStore($modelSettings);

const { selectedLanguage } = modelSettings;

return (
<main className="settings">
<button
className="button-cancel"
aria-label="cancel"
onClick={() => cancelUpload()}
>
{/* <Close /> */}
</button>
<h1>Select language</h1>
<p className="language-description">
Choose the main language that is spoken in the file, to help us get the best
transcription.
</p>
<div className="file-info">
<p>{files.files.map(file => file.name).join(', ')}</p>
</div>
<select
name="language"
id="language"
className="select-dropdown"
onChange={(event) => setSelectedLanguage(event.target.value)}
>
<option value="detect-language">Detect language</option>
{languages.map((language) => (
<option
key={language}
selected={language === selectedLanguage}
value={language}
>
{language}
</option>
))}
</select>
<button className="button-upload" onClick={() => setSettingTab(1)}>
Next
</button>
</main>
);
};

export default LanguageSettings;
Loading