-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #18 from kscalelabs/second_milestone_serhii
features_frontend_UI_and_backend_basic_APIs_before_integrating
- Loading branch information
Showing
44 changed files
with
8,218 additions
and
5,562 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
[MASTER] | ||
# Python version to use (default: python3). | ||
python-version= 3.11.9 | ||
ignore=venv | ||
[MESSAGES CONTROL] | ||
# Enable specific messages. Disable all warnings except for W0401 and E1101. | ||
disable=E0401, E0015 | ||
|
||
[FORMAT] | ||
# Maximum number of characters on a single line (default: 100). Increase to 120. | ||
max-line-length=120 | ||
|
||
[DESIGN] | ||
# Maximum number of arguments for functions or methods (default: 5). Increase to 7. | ||
max-args=7 | ||
|
||
[IMPORTS] | ||
# List of modules to ignore for import errors (e.g., 'module_that_does_not_exist'). | ||
ignored-modules= |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,8 @@ | ||
@import url("https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;700&display=swap"); | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
body { | ||
font-family: "Noto Serif SC", serif; /* Use Noto Serif Simplified Chinese font */ | ||
} | ||
|
||
div.content { | ||
margin-top: 16px; | ||
margin-bottom: 56px; | ||
} | ||
|
||
@media (max-width: 768px) { | ||
div.row-two { | ||
gap: 16px; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// src/api/auth.ts | ||
import axios from "axios"; | ||
import { | ||
SigninData, | ||
SignupData, | ||
SignupResponse, | ||
SignupResponseBusiness, | ||
} from "types/auth"; | ||
|
||
const API_URL = process.env.REACT_APP_BACKEND_URL || "https://localhost:8080"; | ||
|
||
export const signup = async (data: SignupData): Promise<SignupResponse> => { | ||
const response = await axios.post(`${API_URL}/signup`, data); | ||
return response.data; | ||
}; | ||
export const read_me = async (token: string): Promise<SignupResponse> => { | ||
const response = await axios.get(`${API_URL}/api/user/me`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
return response.data; | ||
}; | ||
export const read_me_business = async ( | ||
token: string, | ||
): Promise<SignupResponseBusiness> => { | ||
const response = await axios.get(`${API_URL}/api/business/me`, { | ||
headers: { | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}); | ||
return response.data; | ||
}; | ||
export const signin = async (data: SigninData): Promise<SignupResponse> => { | ||
const params = new URLSearchParams(); | ||
params.append("username", data.email); | ||
params.append("password", data.password); | ||
const response = await axios.post(`${API_URL}/api/user/token`, params); | ||
console.log(response); | ||
return response.data; | ||
}; | ||
export const social_facebook_login = async ( | ||
token: string, | ||
): Promise<SignupResponse> => { | ||
console.log(token); | ||
const response = await axios.post( | ||
`${API_URL}/api/facebook/callback`, | ||
{ | ||
token: token, | ||
}, | ||
{ | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}, | ||
); | ||
return response.data; | ||
}; | ||
export const social_Instagram_login = async ( | ||
token: string, | ||
): Promise<SignupResponse> => { | ||
const response = await axios.post( | ||
`${API_URL}/api/instagram/callback`, | ||
{ | ||
token: token, | ||
}, | ||
{ | ||
headers: { | ||
"Content-Type": "application/json", | ||
}, | ||
}, | ||
); | ||
return response.data; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
import { useNavigate } from "react-router-dom"; | ||
import { Collection } from "types/model"; | ||
|
||
const CardItem: React.FC<Collection> = (collectionProps) => { | ||
const { id, title, description, images } = collectionProps; | ||
const navigate = useNavigate(); | ||
|
||
const handleOpen = () => { | ||
navigate(`/collection/${id}`); | ||
}; | ||
|
||
const handleEdit = () => { | ||
navigate(`/collection/${id}?Action=edit`); | ||
}; | ||
|
||
return ( | ||
<div className="relative m-4 group"> | ||
<div className="relative z-10 w-52 h-72 p-3 bg-rose-100 dark:bg-gray-900 border flex flex-col gap-2 opacity-95"> | ||
<h3 className="text-lg font-bold">{title}</h3> | ||
<p className="text-sm text-gray-900 dark:text-gray-100"> | ||
{description} | ||
</p> | ||
<p className="text-sm text-gray-800 dark:text-gray-200 grow"> | ||
{images.length} Images | ||
</p> | ||
<div className="absolute inset-0 flex items-end pb-3 justify-center group-hover:opacity-100 opacity-0 transition-opacity"> | ||
<div className="flex gap-2"> | ||
<button | ||
className="bg-blue-500 text-white px-3 py-1 rounded" | ||
onClick={handleOpen} | ||
> | ||
Open | ||
</button> | ||
<button | ||
className="bg-slate-700 text-white px-3 py-1 rounded" | ||
onClick={handleEdit} | ||
> | ||
Edit | ||
</button> | ||
</div> | ||
</div> | ||
</div> | ||
<div className="absolute top-5 left-5 w-52 h-72 bg-slate-300 shadow-sm"></div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default CardItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import React from "react"; | ||
import { CheckCircleFill, LockFill, PencilFill } from "react-bootstrap-icons"; | ||
import { Image } from "types/model"; | ||
|
||
const ImageComponent: React.FC<Image> = ({ | ||
// id, | ||
is_translated, | ||
image_url, | ||
// audio_url, | ||
transcript, | ||
}) => { | ||
return ( | ||
<div | ||
className="relative w-full h-80 min-w-80 bg-cover bg-center border-1 border-gray-800 dark:border-gray-50" | ||
style={{ backgroundImage: `url(${image_url})` }} | ||
> | ||
<div className="absolute inset-0 flex flex-col items-center justify-center bg-gray-900/30"> | ||
{is_translated ? ( | ||
<> | ||
<div className="absolute top-2 right-2 flex items-center text-white bg-green-600 py-1 px-3 rounded text-xs"> | ||
<CheckCircleFill size={15} className="mr-2" /> | ||
<span>The image has been translated</span> | ||
</div> | ||
<div className="absolute bottom-2 text-white bg-gray-800 py-1 px-3 mx-2 rounded"> | ||
<span>{transcript}</span> | ||
</div> | ||
</> | ||
) : ( | ||
<> | ||
<div className="absolute top-2 right-2 flex items-center text-white bg-red-600 py-1 px-3 rounded text-xs"> | ||
<LockFill size={13} className="mr-2" /> | ||
<span>It needs to be translated</span> | ||
</div> | ||
</> | ||
)} | ||
{/* Centered Edit Button */} | ||
<div className="absolute inset-x-0 bottom-1/2 transform translate-y-1/2 flex items-center justify-center gap-2"> | ||
{is_translated ? ( | ||
<button className="bg-yellow-500 text-white py-1 px-3 rounded flex items-center"> | ||
<PencilFill className="mr-2" /> | ||
Edit | ||
</button> | ||
) : ( | ||
<button className="bg-blue-500 text-white py-1 px-3 rounded"> | ||
Translate | ||
</button> | ||
)} | ||
</div> | ||
</div> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ImageComponent; |
Oops, something went wrong.