fixed Github repos not getting accessed and their CSS

This commit is contained in:
QkoSad
2024-09-28 16:13:05 +03:00
parent 9bc2015426
commit c6b7bfbea1
6 changed files with 41 additions and 27 deletions
@@ -6,7 +6,6 @@ import Experience from "./Experience";
import Education from "./Education"; import Education from "./Education";
import { getCurrentProfile, deleteAccount } from "../../actions/profile"; import { getCurrentProfile, deleteAccount } from "../../actions/profile";
import { Box, Button, Typography } from "@mui/material"; import { Box, Button, Typography } from "@mui/material";
import { compose } from "redux";
const Dashboard = () => { const Dashboard = () => {
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
@@ -12,7 +12,6 @@ import {
TableCell, TableCell,
TableHead, TableHead,
Typography, Typography,
TableContainer,
} from "@mui/material"; } from "@mui/material";
const Education = ({ education }: { education: EducationType[] }) => { const Education = ({ education }: { education: EducationType[] }) => {
+7 -3
View File
@@ -74,7 +74,9 @@ const Profile = () => {
<ProfileAbout profile={profile} /> <ProfileAbout profile={profile} />
</Grid> </Grid>
<Grid size={{ xs: 12, md: 6 }}> <Grid size={{ xs: 12, md: 6 }}>
<Typography variant="h2">Experience</Typography> <Typography variant="h2" color="info">
Experience
</Typography>
{profile.experience.length > 0 ? ( {profile.experience.length > 0 ? (
<> <>
{profile.experience.map((experience: ExperienceType) => ( {profile.experience.map((experience: ExperienceType) => (
@@ -88,8 +90,10 @@ const Profile = () => {
<Typography variant="h4">No experience credentials</Typography> <Typography variant="h4">No experience credentials</Typography>
)} )}
</Grid> </Grid>
<Grid size={6}> <Grid size={{ xs: 12, md: 6 }}>
<Typography variant="h2">Education</Typography> <Typography variant="h2" color="info">
Education
</Typography>
{profile.education.length > 0 ? ( {profile.education.length > 0 ? (
<> <>
{profile.education.map((education: EducationType) => ( {profile.education.map((education: EducationType) => (
+31 -19
View File
@@ -1,3 +1,4 @@
import { Box, List, ListItem, Paper, Typography } from "@mui/material";
import React, { useEffect } from "react"; import React, { useEffect } from "react";
import { getGithubRepos } from "../../actions/profile"; import { getGithubRepos } from "../../actions/profile";
import { useAppDispatch, useAppSelector } from "../../utils/hooks"; import { useAppDispatch, useAppSelector } from "../../utils/hooks";
@@ -13,28 +14,39 @@ const ProfileGithub = ({ username }: { username: string }) => {
}, [dispatch, username]); }, [dispatch, username]);
return ( return (
<div> <Box sx={{ width: { md: "50%", xs: "100%" } }}>
<h2>Github Repos</h2> <Typography variant="h2" color="info">
{repos.map((repo) => ( Github Repos
<div key={repo.id}> </Typography>
<div> {repos.map((repo) => {
<h4> return (
<Paper
key={repo.id}
elevation={12}
sx={{ margin: "10px", padding: "4px" }}
>
<Typography variant="h4">
<a href={repo.html_url} target="_blank" rel="noopener noreferrer"> <a href={repo.html_url} target="_blank" rel="noopener noreferrer">
{repo.name} {repo.name}
</a> </a>
</h4> </Typography>
<p>{repo.description}</p> <Typography
</div> sx={{
<div> textWrap: "wrap",
<ul> wordBreak: "break-word",
<li>Stars: {repo.stargazers_count}</li> }}
<li>Watchers: {repo.watchers_count}</li> >
<li>Forks: {repo.forks_count}</li> {repo.description}
</ul> </Typography>
</div> <List>
</div> <ListItem>Stars: {repo.stargazers_count}</ListItem>
))} <ListItem>Watchers: {repo.watchers_count}</ListItem>
</div> <ListItem>Forks: {repo.forks_count}</ListItem>
</List>
</Paper>
);
})}
</Box>
); );
}; };
+3 -1
View File
@@ -18,7 +18,9 @@ const ProfileTop = ({
return ( return (
<> <>
<img src={avatar} alt="" /> <img src={avatar} alt="" />
<Typography variant="h2">{name}</Typography> <Typography variant="h2" color="info">
{name}
</Typography>
<Typography sx={{ textWrap: "wrap" }}> <Typography sx={{ textWrap: "wrap" }}>
{status} {company ? <span> at {company}</span> : null} {status} {company ? <span> at {company}</span> : null}
</Typography> </Typography>
-2
View File
@@ -297,8 +297,6 @@ router.delete("/education/:edu_id", auth, async (req, res) => {
// @desc Get user repos from Github // @desc Get user repos from Github
// @access Public // @access Public
router.get("/github/:username", async (req, res) => { router.get("/github/:username", async (req, res) => {
console.log(config.get("githubToken"));
console.log(req.params.username);
try { try {
const uri = encodeURI( const uri = encodeURI(
`https://api.github.com/users/${req.params.username}/repos?per_page=5&sort=created:asc`, `https://api.github.com/users/${req.params.username}/repos?per_page=5&sort=created:asc`,