project shifted from .js to .tsx
This commit is contained in:
parent
fff24db214
commit
f93488aa71
@ -1,7 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"baseUrl": "./src",
|
|
||||||
"checkJs": true,
|
|
||||||
"jsx": "react"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
12
package-lock.json
generated
12
package-lock.json
generated
@ -24,6 +24,9 @@
|
|||||||
"react-router-dom": "^6.19.0",
|
"react-router-dom": "^6.19.0",
|
||||||
"react-scripts": "5.0.1",
|
"react-scripts": "5.0.1",
|
||||||
"web-vitals": "^2.1.4"
|
"web-vitals": "^2.1.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@aashutoshrathi/word-wrap": {
|
"node_modules/@aashutoshrathi/word-wrap": {
|
||||||
@ -17428,16 +17431,15 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/typescript": {
|
"node_modules/typescript": {
|
||||||
"version": "4.9.5",
|
"version": "5.3.3",
|
||||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-4.9.5.tgz",
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.3.3.tgz",
|
||||||
"integrity": "sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g==",
|
"integrity": "sha512-pXWcraxM0uxAS+tN0AG/BF2TyqmHO014Z070UsJ+pFvYuRSq8KH8DmWpnbXe0pEPDHXZV3FcAbJkijJ5oNEnWw==",
|
||||||
"peer": true,
|
|
||||||
"bin": {
|
"bin": {
|
||||||
"tsc": "bin/tsc",
|
"tsc": "bin/tsc",
|
||||||
"tsserver": "bin/tsserver"
|
"tsserver": "bin/tsserver"
|
||||||
},
|
},
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=4.2.0"
|
"node": ">=14.17"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/unbox-primitive": {
|
"node_modules/unbox-primitive": {
|
||||||
|
|||||||
@ -43,5 +43,8 @@
|
|||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
"last 1 safari version"
|
"last 1 safari version"
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.3.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
42
public/config/config.json
Normal file
42
public/config/config.json
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
{
|
||||||
|
"userName" : "Vipeesh",
|
||||||
|
"apiUrl" : "http://localhost:8080/SonyMusicRights",
|
||||||
|
"facebook" : "https://www.facebook.com",
|
||||||
|
"twiter" : "https://twitter.com",
|
||||||
|
"instagram" : "https://www.instagram.com",
|
||||||
|
"youtube" : "https://www.youtube.com",
|
||||||
|
"downloadRole": "admin",
|
||||||
|
"projectLevelDataDownloadFileName": "Project data",
|
||||||
|
"assetLevelDataDownloadFileName": "Project and Asset data",
|
||||||
|
"menuList" : [{
|
||||||
|
"name": "Home",
|
||||||
|
"link": "/SonyMusicRights",
|
||||||
|
"type": "intern"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Projects",
|
||||||
|
"link": "/SonyMusicRights/projects",
|
||||||
|
"type": "intern"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Search",
|
||||||
|
"link": "/SonyMusicRights/search",
|
||||||
|
"type": "intern"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Admin",
|
||||||
|
"link": "/SonyMusicRights/admin",
|
||||||
|
"type": "intern"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Manage Users",
|
||||||
|
"link": "/SonyMusicRights/user-management",
|
||||||
|
"type": "intern"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "Intranet Users",
|
||||||
|
"link": "/SonyMusicRights/intranet-user-management",
|
||||||
|
"type": "intern"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export const fetchPublishedProjects = (searchBy, config) => {
|
export const fetchAutolinkedAssets = (searchBy:any, config:any) => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const response = await axios.get(`${config.apiUrl}/autolinked-assets`, {
|
const response = await axios.get(`${config.apiUrl}/autolinked-assets`, {
|
||||||
params: {
|
params: {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export const fetchLinkedProjects = (searchBy, config) => {
|
export const fetchLinkedProjects = (searchBy:any, config:any) => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const response = await axios.get(`${config.apiUrl}/linked-project`, {
|
const response = await axios.get(`${config.apiUrl}/linked-project`, {
|
||||||
params: {
|
params: {
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export const fetchProjects = (searchBy, config) => {
|
export const fetchProjects = (searchBy:any, config:any) => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const response = await axios.get(`${config.apiUrl}/project-list`, {
|
const response = await axios.post(`${config.apiUrl}/project-list`, {
|
||||||
params: {
|
params: {
|
||||||
searchBy
|
searchBy
|
||||||
}
|
}
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export const fetchPublishedProjects = (searchBy, config) => {
|
export const fetchPublishedProjects = (searchBy:any, config:any) => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const response = await axios.get(`${config.apiUrl}/published-project`, {
|
const response = await axios.get(`${config.apiUrl}/published-project`, {
|
||||||
params: {
|
params: {
|
||||||
@ -1,7 +1,7 @@
|
|||||||
import { useQuery } from '@tanstack/react-query';
|
import { useQuery } from '@tanstack/react-query';
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
export const fetchUnlinkedProjects = (searchBy, config) => {
|
export const fetchUnlinkedProjects = (searchBy:any, config:any) => {
|
||||||
const fetchData = async () => {
|
const fetchData = async () => {
|
||||||
const response = await axios.get(`${config.apiUrl}/unlinked-project`, {
|
const response = await axios.get(`${config.apiUrl}/unlinked-project`, {
|
||||||
params: {
|
params: {
|
||||||
@ -1,13 +1,11 @@
|
|||||||
import logo from './logo.svg';
|
|
||||||
import './App.css';
|
import './App.css';
|
||||||
import Header from './components/Header';
|
import Header from './components/Header';
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
||||||
import { Container } from '@mui/material';
|
import { Container } from '@mui/material';
|
||||||
import { BrowserRouter as Router, Routes, Route, BrowserRouter} from 'react-router-dom'
|
import { BrowserRouter as Router, Routes, Route, BrowserRouter} from 'react-router-dom'
|
||||||
import Dashboard from 'components/Dashboard';
|
import Dashboard from './components/Dashboard';
|
||||||
import { Counter } from 'components/counterC';
|
import Projects from './components/projects/Projects';
|
||||||
import Projects from 'components/projects/Projects';
|
|
||||||
|
|
||||||
|
|
||||||
function App() {
|
function App() {
|
||||||
@ -1,15 +1,14 @@
|
|||||||
import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material";
|
import { Box, Card, CardContent, Grid, Paper, Typography, styled } from "@mui/material";
|
||||||
import React, { useEffect } from "react";
|
import React, { useEffect } from "react";
|
||||||
import { getLinkedProjects, useGetLinkedProjects } from "APIs/getLinkedProjects";
|
// import { getLinkedProjects, useGetLinkedProjects } from "APIs/getLinkedProjects";
|
||||||
import { useGetUnlinkedProjects } from "APIs/getUnlinkedProjects";
|
// import { useGetUnlinkedProjects } from "APIs/getUnlinkedProjects";
|
||||||
import { useGetProjectData } from "APIs/getProject";
|
// import { useGetProjectData } from "APIs/getProject";
|
||||||
|
|
||||||
export default function Dashboard(){
|
export default function Dashboard(){
|
||||||
|
|
||||||
const [linkedProjectData, setLinkedProjectData] = React.useState()
|
const [linkedProjectData, setLinkedProjectData] = React.useState()
|
||||||
const { data: getLinkedProjectList } = useGetLinkedProjects();
|
// const { data: getLinkedProjectList } = useGetLinkedProjects();
|
||||||
const { data: getUnlinkedProjectList } = useGetUnlinkedProjects();
|
// const { data: getUnlinkedProjectList } = useGetUnlinkedProjects();
|
||||||
const { data: getProjectDataList } = useGetProjectData();
|
|
||||||
|
|
||||||
const Item = styled(Paper)(({ theme }) => ({
|
const Item = styled(Paper)(({ theme }) => ({
|
||||||
backgroundColor: '#1e1e1e',
|
backgroundColor: '#1e1e1e',
|
||||||
@ -18,7 +17,6 @@ export default function Dashboard(){
|
|||||||
textAlign: 'left',
|
textAlign: 'left',
|
||||||
|
|
||||||
}));
|
}));
|
||||||
console.log('sdfsds',getProjectDataList)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Paper square className="app-background app-screen-heights">
|
<Paper square className="app-background app-screen-heights">
|
||||||
@ -29,7 +27,7 @@ export default function Dashboard(){
|
|||||||
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
<Grid container spacing={2} sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
<Typography component="h2" variant="h2" style={{color: '#C00243', fontWeight: 'bold'}}>
|
||||||
{getUnlinkedProjectList && getUnlinkedProjectList.length}
|
{/* {getUnlinkedProjectList && getUnlinkedProjectList.length} */}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
@ -45,7 +43,7 @@ export default function Dashboard(){
|
|||||||
<Grid container sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
<Grid container sx={{flexDirection:'row', flexWrap:'nowrap'}}>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Typography component="h2" variant="h2" style={{color: '#E1AB1A', fontWeight: 'bold'}}>
|
<Typography component="h2" variant="h2" style={{color: '#E1AB1A', fontWeight: 'bold'}}>
|
||||||
{getLinkedProjectList && getLinkedProjectList.length}
|
{/* {getLinkedProjectList && getLinkedProjectList.length} */}
|
||||||
</Typography>
|
</Typography>
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid item>
|
<Grid item>
|
||||||
@ -22,10 +22,10 @@ function Header() {
|
|||||||
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
const [anchorElNav, setAnchorElNav] = React.useState(null);
|
||||||
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
const [anchorElUser, setAnchorElUser] = React.useState(null);
|
||||||
|
|
||||||
const handleOpenNavMenu = (event) => {
|
const handleOpenNavMenu = (event:any) => {
|
||||||
setAnchorElNav(event.currentTarget);
|
setAnchorElNav(event.currentTarget);
|
||||||
};
|
};
|
||||||
const handleOpenUserMenu = (event) => {
|
const handleOpenUserMenu = (event:any) => {
|
||||||
setAnchorElUser(event.currentTarget);
|
setAnchorElUser(event.currentTarget);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1,17 +1,32 @@
|
|||||||
import React from "react";
|
import React from "react";
|
||||||
import ProjectList from "./ProjectsList";
|
import ProjectList from "./ProjectsList";
|
||||||
import { useGetProjectData } from "APIs/getProject";
|
import { useGetProjectData } from "../../APIs/getProject";
|
||||||
import ProjectFilter from "./ProjectFilter";
|
// import ProjectFilter from "./ProjectFilter";
|
||||||
import { useState } from "react";
|
import { useState } from "react";
|
||||||
import { useEffect } from "react";
|
import { useEffect } from "react";
|
||||||
import { Box, Card, CardContent, FormControl, Grid, InputLabel, MenuItem, Paper, Select, TextField } from "@mui/material";
|
import { Box, Card, CardContent, FormControl, Grid, InputLabel, MenuItem, Paper, Select, TextField } from "@mui/material";
|
||||||
|
import { useMutation } from "@tanstack/react-query";
|
||||||
|
// import { fetchProjects } from "APIs/ProjectScreenAPIs/getProject";
|
||||||
|
// import { useGetProjectData } from 'APIs/getProject';
|
||||||
|
|
||||||
|
|
||||||
export default function Projects(){
|
export default function Projects(){
|
||||||
const { data: getProjectDataList } = useGetProjectData();
|
const { data: getProjectDataList } = useGetProjectData();
|
||||||
const [selectedContractFilter, setSelectedContractFilter] = useState('All');
|
const [selectedContractFilter, setSelectedContractFilter] = useState<any>('All');
|
||||||
const [searchBy, setSearchBy] = useState('');
|
const [searchBy, setSearchBy] = useState('');
|
||||||
|
|
||||||
|
// const { mutate } = useMutation(fetchProjects, {
|
||||||
|
// onSuccess: (data) => {
|
||||||
|
// },
|
||||||
|
// onError: () => {
|
||||||
|
// alert('There was an error');
|
||||||
|
// },
|
||||||
|
// onSettled: () => {},
|
||||||
|
// });
|
||||||
|
|
||||||
|
// useEffect(()=>{
|
||||||
|
|
||||||
|
// })
|
||||||
// useEffect(() => {
|
// useEffect(() => {
|
||||||
// setSelectedContractFilter(props.location.state ? props.location.state.type : 'All');
|
// setSelectedContractFilter(props.location.state ? props.location.state.type : 'All');
|
||||||
// setSearchBy('');
|
// setSearchBy('');
|
||||||
@ -37,7 +37,7 @@ const columns = [
|
|||||||
{
|
{
|
||||||
id: 'term',
|
id: 'term',
|
||||||
label: 'Term',
|
label: 'Term',
|
||||||
Cell: ({ row }) => (
|
Cell: (row:any) => (
|
||||||
(row.perpetuity !== '' && row.perpetuity !== null)
|
(row.perpetuity !== '' && row.perpetuity !== null)
|
||||||
? (row.perpetuity !== "Yes" ? <span>{row.effective_from1} - {row.effective_to1}</span> : `${row.effective_from1} - Perpetual`)
|
? (row.perpetuity !== "Yes" ? <span>{row.effective_from1} - {row.effective_to1}</span> : `${row.effective_from1} - Perpetual`)
|
||||||
: ""
|
: ""
|
||||||
@ -46,7 +46,7 @@ const columns = [
|
|||||||
{
|
{
|
||||||
id: 'link',
|
id: 'link',
|
||||||
label: 'Link',
|
label: 'Link',
|
||||||
Cell: ({ row }) => (
|
Cell: (row:any) => (
|
||||||
(row.cid === null || row.cid === 0 || row.effective_from1 === null)
|
(row.cid === null || row.cid === 0 || row.effective_from1 === null)
|
||||||
? <Button component={Link} to={{ pathname: `${process.env.PUBLIC_URL}/${row.id}/project-details` }} variant="contained" size="small">Link</Button>
|
? <Button component={Link} to={{ pathname: `${process.env.PUBLIC_URL}/${row.id}/project-details` }} variant="contained" size="small">Link</Button>
|
||||||
: (row.published === 1
|
: (row.published === 1
|
||||||
@ -59,16 +59,20 @@ const columns = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
type Props={
|
||||||
|
projectData:any
|
||||||
|
}
|
||||||
|
|
||||||
export default function ProjectList({projectData}) {
|
|
||||||
|
export default function ProjectList({projectData}:Props) {
|
||||||
const [page, setPage] = React.useState(0);
|
const [page, setPage] = React.useState(0);
|
||||||
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
const [rowsPerPage, setRowsPerPage] = React.useState(10);
|
||||||
|
|
||||||
const handleChangePage = (event, newPage) => {
|
const handleChangePage = (event:any, newPage:any) => {
|
||||||
setPage(newPage);
|
setPage(newPage);
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleChangeRowsPerPage = (event) => {
|
const handleChangeRowsPerPage = (event:any) => {
|
||||||
setRowsPerPage(+event.target.value);
|
setRowsPerPage(+event.target.value);
|
||||||
setPage(0);
|
setPage(0);
|
||||||
};
|
};
|
||||||
@ -95,10 +99,10 @@ export default function ProjectList({projectData}) {
|
|||||||
<TableBody>
|
<TableBody>
|
||||||
{projectData && projectData
|
{projectData && projectData
|
||||||
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
.slice(page * rowsPerPage, page * rowsPerPage + rowsPerPage)
|
||||||
.map((row) => {
|
.map((row:any) => {
|
||||||
return (
|
return (
|
||||||
<TableRow hover role="checkbox" tabIndex={-1} key={row.code}>
|
<TableRow hover role="checkbox" tabIndex={-1} key={row.code}>
|
||||||
{columns.map((column) => {
|
{columns.map((column:any) => {
|
||||||
const value = row[column.id];
|
const value = row[column.id];
|
||||||
return (
|
return (
|
||||||
<TableCell key={column.id}
|
<TableCell key={column.id}
|
||||||
11
tsconfig.json
Normal file
11
tsconfig.json
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
|
||||||
|
"module": "commonjs", /* Specify what module code is generated. */
|
||||||
|
"esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */
|
||||||
|
"forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
|
||||||
|
"strict": true, /* Enable all strict type-checking options. */
|
||||||
|
"skipLibCheck": true ,
|
||||||
|
"jsx": "react", /* Skip type checking all .d.ts files. */
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user