Skip to content

Commit

Permalink
add nepali lang
Browse files Browse the repository at this point in the history
  • Loading branch information
Janderson Souza Matias authored and Janderson Souza Matias committed Nov 22, 2023
1 parent a25df85 commit 4c85d72
Show file tree
Hide file tree
Showing 25 changed files with 376 additions and 221 deletions.
38 changes: 38 additions & 0 deletions .github/workflows/nepal.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Deploy

on:
push:
branches:
- main

jobs:
build:
name: Deploy to server
runs-on: ubuntu-latest
env:
VITE_API_URL: https://coachdigital.org/np/api/
VITE_COUNTRY: np
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v3

- name: 🛠️ Use Node.js 18.x
uses: actions/setup-node@v3
with:
node-version: 18.x

- name: 🛠️ Install dependencies
run: npm install

- name: 🚀 Build
run: npm run build

- name: 🕵🏻 Copy file via ssh key
uses: appleboy/scp-action@master
with:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
source: 'dist'
target: '/usr/share/nginx/html/np/admin'
strip_components: 1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
env:
VITE_API_URL: https://coachdigital.org/sl/api/
BASE_URL: /sl/admin/
VITE_COUNTRY: sl
steps:
- name: 🛎️ Checkout
uses: actions/checkout@v3
Expand All @@ -23,7 +23,7 @@ jobs:

- name: 🛠️ Install dependencies
run: npm install

- name: 🚀 Build
run: npm run build

Expand All @@ -33,6 +33,6 @@ jobs:
host: ${{ secrets.HOST }}
username: ${{ secrets.USERNAME }}
key: ${{ secrets.KEY }}
source: "dist"
target: "/usr/share/nginx/html/sl/admin"
source: 'dist'
target: '/usr/share/nginx/html/sl/admin'
strip_components: 1
21 changes: 0 additions & 21 deletions Dockerfile

This file was deleted.

13 changes: 0 additions & 13 deletions docker-compose.yml

This file was deleted.

8 changes: 0 additions & 8 deletions nginx.conf

This file was deleted.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"@chakra-ui/react": "^2.5.1",
"@emotion/react": "^11.10.6",
"@emotion/styled": "^11.10.6",
"@fontsource/noto-sans": "^5.0.17",
"@hookform/resolvers": "^3.1.1",
"@superset-ui/embedded-sdk": "^0.1.0-alpha.9",
"@types/styled-system": "^5.1.16",
Expand Down
48 changes: 10 additions & 38 deletions src/components/HeaderPage/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import { Button, HStack, Text, VStack } from "@chakra-ui/react";
import Icon from "../Base/Icon";
import { useTranslation } from "react-i18next";
import React from 'react';
import { Button, HStack, Text, VStack } from '@chakra-ui/react';
import Icon from '../Base/Icon';
import { useTranslation } from 'react-i18next';

type Props = {
title: string;
Expand All @@ -11,56 +11,28 @@ type Props = {
onClickDownload?: () => void;
};

const HeaderPage: React.FC<Props> = ({
title,
subtitle,
newButtonValue,
onClickNew,
onClickDownload,
}) => {
const HeaderPage: React.FC<Props> = ({ title, subtitle, newButtonValue, onClickNew, onClickDownload }) => {
const { t } = useTranslation();

return (
<HStack flex={1}>
<VStack flex={1} alignItems="start" mt="60px" mb="24px">
<Text
fontFamily="Inter"
color="#576375"
fontSize="14px"
fontWeight={400}
lineHeight={1}
>
<Text fontFamily="Noto Sans" color="#576375" fontSize="14px" fontWeight={400} lineHeight={1}>
{subtitle}
</Text>
<Text
fontFamily="Inter"
color="#111417"
fontSize="32px"
fontWeight={600}
lineHeight={1}
>
<Text fontFamily="Noto Sans" color="#111417" fontSize="32px" fontWeight={600} lineHeight={1}>
{title}
</Text>
</VStack>
<HStack>
{onClickDownload && (
<Button
variant="solid"
colorScheme="blue"
onClick={onClickDownload}
gap="8px"
>
{t("general.download-data")}
<Button variant="solid" colorScheme="blue" onClick={onClickDownload} gap="8px">
{t('general.download-data')}
</Button>
)}

{newButtonValue && onClickNew && (
<Button
variant="solid"
colorScheme="blue"
onClick={onClickNew}
gap="8px"
>
<Button variant="solid" colorScheme="blue" onClick={onClickNew} gap="8px">
<Icon name="plus" color="#fff" size={24} /> {newButtonValue}
</Button>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Layouts/ProtectedLayout/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export const ProtectedLayout = () => {
const navigate = useNavigate();

useEffect(() => {
if (!user) navigate('/sl/admin/login');
if (!user) navigate(`/${import.meta.env.VITE_COUNTRY}/admin/login`);
}, [user, navigate]);

const flexDir = useBreakpointValue({ base: 'column', md: 'row' }) as 'column' | 'row';
Expand Down
14 changes: 7 additions & 7 deletions src/components/Navbar/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,20 @@ export const MenuItems = [
{
icon: 'chart-line',
label: 'dashboard',
route: '/sl/admin/',
route: `/${import.meta.env.VITE_COUNTRY}/admin/`,
},
{
label: 'questionnaire',
subItems: [
{
icon: 'document-layout-right',
label: 'teaching-practices',
route: '/sl/admin/teaching-practices',
route: `/${import.meta.env.VITE_COUNTRY}/admin/teaching-practices`,
},
{
icon: 'clipboard-notes',
label: 'coaching-sessions',
route: '/sl/admin/coaching-sessions',
route: `/${import.meta.env.VITE_COUNTRY}/admin/coaching-sessions`,
},
],
},
Expand All @@ -25,22 +25,22 @@ export const MenuItems = [
{
icon: 'university',
label: 'schools',
route: '/sl/admin/schools',
route: `/${import.meta.env.VITE_COUNTRY}/admin/schools`,
},
{
icon: 'calender',
label: 'coaches-over-time',
route: '/sl/admin/coach-over-time',
route: `/${import.meta.env.VITE_COUNTRY}/admin/coach-over-time`,
},
{
icon: 'folder',
label: 'session-data',
route: '/sl/admin/session-data',
route: `/${import.meta.env.VITE_COUNTRY}/admin/session-data`,
},
{
icon: 'sync',
label: 'syncs',
route: '/sl/admin/syncs',
route: `/${import.meta.env.VITE_COUNTRY}/admin/syncs`,
},
],
},
Expand Down
78 changes: 17 additions & 61 deletions src/components/UserCard/index.tsx
Original file line number Diff line number Diff line change
@@ -1,78 +1,44 @@
import React, { useMemo } from "react";
import {
Menu,
MenuButton,
MenuList,
MenuItem,
Center,
HStack,
VStack,
Text,
} from "@chakra-ui/react";
import { useNavigate } from "react-router-dom";
import Icon from "../Base/Icon";
import { useTranslation } from "react-i18next";
import React, { useMemo } from 'react';
import { Menu, MenuButton, MenuList, MenuItem, Center, HStack, VStack, Text } from '@chakra-ui/react';
import { useNavigate } from 'react-router-dom';
import Icon from '../Base/Icon';
import { useTranslation } from 'react-i18next';

type Props = { name: string; email: string; logout: () => void };

const UserCard: React.FC<Props> = ({ name, email, logout }) => {
const { t } = useTranslation();
const navigate = useNavigate();
const initials = useMemo(() => {
const splinted = name.split(" ");
return splinted.length > 1
? `${splinted[0][0]}${splinted[1][0]}`
: `${splinted[0][0]}${splinted[0][1]}`;
const splinted = name.split(' ');
return splinted.length > 1 ? `${splinted[0][0]}${splinted[1][0]}` : `${splinted[0][0]}${splinted[0][1]}`;
}, [name]);

const handleSettings = () => {
navigate("/sl/admin/settings");
navigate(`/${import.meta.env.VITE_COUNTRY}/admin/settings`);
};

return (
<Menu>
<MenuButton>
<HStack
w="224px"
p="10px"
boxShadow="0px 1px 6px 0px rgba(0, 0, 0, 0.08)"
borderRadius="16px"
>
<HStack w="224px" p="10px" boxShadow="0px 1px 6px 0px rgba(0, 0, 0, 0.08)" borderRadius="16px">
<Center
borderRadius="50%"
w="40px"
h="40px"
bg="#EBF1FF"
color="#264673"
fontWeight={700}
fontSize={"16px"}
fontSize={'16px'}
textTransform="uppercase"
>
{initials}
</Center>
<VStack
maxW="calc(100% - 80px)"
alignItems="start"
justifyContent="center"
>
<Text
isTruncated
maxWidth="100%"
fontSize={"14px"}
fontWeight={500}
color="#111417"
lineHeight={1}
>
<VStack maxW="calc(100% - 80px)" alignItems="start" justifyContent="center">
<Text isTruncated maxWidth="100%" fontSize={'14px'} fontWeight={500} color="#111417" lineHeight={1}>
{name}
</Text>
<Text
isTruncated
lineHeight={1}
maxWidth="100%"
fontSize={"12px"}
fontWeight={500}
color="#576375"
>
<Text isTruncated lineHeight={1} maxWidth="100%" fontSize={'12px'} fontWeight={500} color="#576375">
{email}
</Text>
</VStack>
Expand All @@ -81,23 +47,13 @@ const UserCard: React.FC<Props> = ({ name, email, logout }) => {
</MenuButton>

<MenuList>
<MenuItem
onClick={handleSettings}
color="#111417"
fontSize={"16px"}
fontWeight={500}
>
<MenuItem onClick={handleSettings} color="#111417" fontSize={'16px'} fontWeight={500}>
<Icon name="setting" color="#111417" mr="8px" size={24} />
{t("Navbar.settings")}
{t('Navbar.settings')}
</MenuItem>
<MenuItem
onClick={logout}
color="#F11D0E"
fontSize={"16px"}
fontWeight={500}
>
<MenuItem onClick={logout} color="#F11D0E" fontSize={'16px'} fontWeight={500}>
<Icon name="signout" color="#F11D0E" mr="8px" size={24} />
{t("Navbar.logout")}
{t('Navbar.logout')}
</MenuItem>
</MenuList>
</Menu>
Expand Down
Loading

0 comments on commit 4c85d72

Please sign in to comment.