Skip to content

Commit

Permalink
Merge pull request #8 from AI4Bharat/react-django
Browse files Browse the repository at this point in the history
UI Fixes
  • Loading branch information
Shanks0465 authored Aug 29, 2024
2 parents e8ac94c + 0bff970 commit 887dd5b
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 51 deletions.
8 changes: 6 additions & 2 deletions frontend/components/Datasets.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const datasetIcons: { [key: string]: React.ReactElement } = {
interface FeatureProps {
title: string;
icon: string;
dataset_link: string;
}

interface Dataset {
Expand All @@ -55,9 +56,9 @@ interface Dataset {
// Aksharantar: { path: "", icon: "/assets/icons/xlit.png" },
// };

const Feature = ({ title, icon }: FeatureProps) => {
const Feature = ({ title, icon, dataset_link }: FeatureProps) => {
return (
<Stack>
<Stack as={Link} href={dataset_link}>
<Flex
w={16}
h={16}
Expand Down Expand Up @@ -192,6 +193,9 @@ export default function Datasets() {
<Feature
icon={dataset.area.toLowerCase()}
title={dataset.title}
dataset_link={
dataset.website_link ? dataset.website_link : ""
}
/>
</CardBody>
</Card>
Expand Down
21 changes: 6 additions & 15 deletions frontend/components/TryOut/NMT.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ import {
import { LANGUAGE_CODE_NAMES } from "@/app/config";
import axios from "axios";
import { API_URL } from "@/app/config";
const IndicTransliterate =
typeof window !== "undefined"
? require("@ai4bharat/indic-transliterate").IndicTransliterate
: null;
import { IndicTransliterate } from "@ai4bharat/indic-transliterate";

const fetchTranslation = async ({
sourceLanguage,
Expand Down Expand Up @@ -124,29 +121,23 @@ export default function NMT({
</VStack>
</HStack>
<VStack w={"full"}>
{/* <IndicTransliterate
<IndicTransliterate
enabled={sourceLanguage !== "en" && transliteration}
renderComponent={(props) => (
<Textarea
minWidth={270}
width={{ base: "90%", md: "80%", lg: "100%" }}
{...props}
/>
)}
renderComponent={(props) => <Textarea {...props} />}
value={inputText}
onChangeText={(text) => {
setInputText(text);
}}
lang={sourceLanguage}
/> */}
<Textarea
/>
{/* <Textarea
minWidth={270}
width={{ base: "90%", md: "80%", lg: "100%" }}
value={inputText}
onChange={(event) => {
setInputText(event.target.value);
}}
/>
/> */}
<Textarea value={outputText} isReadOnly></Textarea>
<Button
onClick={async () => {
Expand Down
8 changes: 4 additions & 4 deletions frontend/package-lock.json

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

2 changes: 1 addition & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@ai4bharat/indic-transliterate": "^1.3.7",
"@ai4bharat/indic-transliterate": "^1.3.2",
"@chakra-ui/icons": "^2.1.1",
"@chakra-ui/react": "^2.8.2",
"@emotion/react": "^11.13.3",
Expand Down
4 changes: 0 additions & 4 deletions frontend/src/app/areas/model/[area]/[title]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { title } from "process";
import ModelView from "../../../../../../components/Models";

interface ParamsType {
slug: Array<string>;
}

interface Model {
area: string;
title: string;
Expand Down
25 changes: 0 additions & 25 deletions frontend/src/app/tools/[slug]/page.tsx

This file was deleted.

26 changes: 26 additions & 0 deletions frontend/src/app/tools/[tool]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import ToolComponent from "../../../../components/Dynamic/Tool";
import axios from "axios";

interface ToolType {
title: string;
}

export async function generateStaticParams() {
const response = await axios.get("https://admin.models.ai4bharat.org/tools/");

const tools = response.data;

let params: any[] = [];

tools.forEach((tool: ToolType) => {
params.push({
tool: tool.title,
});
});

return params;
}
export const dynamicParams = true;
export default function Tool({ params }: { params: { tool: string } }) {
return <ToolComponent slug={params.tool} />;
}

0 comments on commit 887dd5b

Please sign in to comment.