Skip to content

Commit

Permalink
feat: new website version
Browse files Browse the repository at this point in the history
  • Loading branch information
igor17400 committed Oct 4, 2024
1 parent efb09e9 commit 118e553
Show file tree
Hide file tree
Showing 7 changed files with 63 additions and 13 deletions.
14 changes: 7 additions & 7 deletions gitprofile.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ const CONFIG = {
projects: {
github: {
display: true, // Display GitHub projects?
header: 'Github Projects',
header: 'Projects',
mode: 'manual', // Mode can be: 'automatic' or 'manual'
automatic: {
sortBy: 'stars', // Sort projects by 'stars' or 'updated'
sortBy: 'updated', // Sort projects by 'stars' or 'updated'
limit: 8, // How many projects to display.
exclude: {
forks: false, // Forked projects will not be displayed if set to true.
Expand All @@ -25,12 +25,12 @@ const CONFIG = {
},
manual: {
// Properties for manually specifying projects
sortBy: 'updated',
projects: [
'igor17400/igor17400.github.io',
'igor17400/algorithms-174',
'igor17400/information-theory-174',
'igor17400/deep-learning-174',
'igor17400/linktree-profile',
'igor17400/n2s-algo',
'igor17400/n2s-info-theory',
'igor17400/n2s-dsp',
], // List of repository names to display. example: ['arifszn/my-project1', 'arifszn/my-project2']
},
},
Expand Down Expand Up @@ -92,7 +92,7 @@ const CONFIG = {
},
resume: {
fileUrl:
'https://drive.google.com/file/d/1KanE0fAWfujOY-ZsuRIKAUxhnuRhDT8H/view?usp=sharing',
'https://drive.google.com/file/d/1Q8JOiaVUqFnytBTCQIEXqMazJ0pR1ckM/view?usp=sharing',
},
skills: [
'Python',
Expand Down
14 changes: 12 additions & 2 deletions src/components/github-project-card/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { AiOutlineFork, AiOutlineStar } from 'react-icons/ai';
import { MdInsertLink } from 'react-icons/md';
import { ga, getLanguageColor, skeleton } from '../../utils';
import { GithubProject } from '../../interfaces/github-project';
import { GoLinkExternal } from 'react-icons/go';

const GithubProjectCard = ({
header,
Expand Down Expand Up @@ -95,11 +96,20 @@ const GithubProjectCard = ({
console.error(error);
}

window?.open(item.html_url, '_blank');
window?.open(item.homepage ? item.homepage : item.html_url, '_blank');
}}
>
<div className="flex justify-between flex-col p-8 h-full w-full">
<div className="flex justify-between flex-col p-4 h-full w-full">
<div>
<div className="flex">
<div className="flex-grow" />
<div
className="text-lg flex items-start justify-end"
style={{ flexBasis: '15%' }}
>
<GoLinkExternal />
</div>
</div>
<div className="flex items-center truncate">
<div className="card-title text-lg tracking-wide flex text-base-content opacity-60">
<MdInsertLink className="my-auto" />
Expand Down
29 changes: 28 additions & 1 deletion src/components/gitprofile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ import { GithubProject } from '../interfaces/github-project';
import BlogCard from './blog-card';
import Footer from './footer';
import PublicationCard from './publication-card';
import ExternalProjectCard from './external-project-card';
import GithubProjectCard from './github-project-card';

/**
* Renders the GitProfile component.
Expand All @@ -43,6 +45,7 @@ const GitProfile = ({ config }: { config: Config }) => {
const [error, setError] = useState<CustomError | null>(null);
const [loading, setLoading] = useState<boolean>(false);
const [profile, setProfile] = useState<Profile | null>(null);
const [githubProjects, setGithubProjects] = useState<GithubProject[]>([]);

const getGithubProjects = useCallback(
async (publicRepoCount: number): Promise<GithubProject[]> => {
Expand All @@ -69,11 +72,12 @@ const GitProfile = ({ config }: { config: Config }) => {
if (sanitizedConfig.projects.github.manual.projects.length === 0) {
return [];
}

const repos = sanitizedConfig.projects.github.manual.projects
.map((project) => `+repo:${project}`)
.join('');

const url = `https://api.github.com/search/repositories?q=${repos}+fork:true&type=Repositories`;
const url = `https://api.github.com/search/repositories?q=${repos}+fork:true&type=Repositories&sort=${sanitizedConfig.projects.github.manual.sortBy}`;

const repoResponse = await axios.get(url, {
headers: { 'Content-Type': 'application/vnd.github.v3+json' },
Expand Down Expand Up @@ -114,6 +118,8 @@ const GitProfile = ({ config }: { config: Config }) => {
if (!sanitizedConfig.projects.github.display) {
return;
}

setGithubProjects(await getGithubProjects(data.public_repos));
} catch (error) {
handleError(error as AxiosError | Error);
} finally {
Expand Down Expand Up @@ -246,6 +252,27 @@ const GitProfile = ({ config }: { config: Config }) => {
publications={sanitizedConfig.publications}
/>
)}
{sanitizedConfig.projects.github.display && (
<GithubProjectCard
header={sanitizedConfig.projects.github.header}
limit={sanitizedConfig.projects.github.automatic.limit}
githubProjects={githubProjects}
loading={loading}
username={sanitizedConfig.github.username}
googleAnalyticsId={sanitizedConfig.googleAnalytics.id}
/>
)}
{sanitizedConfig.projects.external.projects.length !==
0 && (
<ExternalProjectCard
loading={loading}
header={sanitizedConfig.projects.external.header}
externalProjects={
sanitizedConfig.projects.external.projects
}
googleAnalyticId={sanitizedConfig.googleAnalytics.id}
/>
)}
{sanitizedConfig.blog.display && (
<BlogCard
loading={loading}
Expand Down
15 changes: 14 additions & 1 deletion src/components/publication-card/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { Fragment } from 'react';
import { SanitizedPublication } from '../../interfaces/sanitized-config';
import { skeleton } from '../../utils';
import { GoLinkExternal } from 'react-icons/go';

const PublicationCard = ({
publications,
Expand Down Expand Up @@ -91,7 +92,19 @@ const PublicationCard = ({
<div className="w-full">
<div className="px-2 sm:px-4">
<div className="text-center w-full">
<h2 className="font-medium opacity-60 mb-2 text-xl italic">
<div className="flex py-2">
<div className="flex-grow" />
<div
className="text-lg flex items-start justify-end"
style={{ flexBasis: '15%' }}
>
<GoLinkExternal />
</div>
</div>
<h2
className="font-medium opacity-60 mb-2 text-xl italic"
style={{ flexBasis: '85%' }}
>
{item.title}
</h2>
{item.conferenceName && (
Expand Down
1 change: 1 addition & 0 deletions src/interfaces/github-project.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@ export interface GithubProject {
stargazers_count: string;
forks_count: string;
language: string;
homepage: string;
}
1 change: 1 addition & 0 deletions src/interfaces/sanitized-config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ export interface SanitizedGitHubProjects {
};
};
manual: {
sortBy: string;
projects: Array<string>;
};
}
Expand Down
2 changes: 0 additions & 2 deletions src/utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,6 @@ export const getInitialTheme = (themeConfig: SanitizedThemeConfig): string => {
!(localStorage.getItem(LOCAL_STORAGE_KEY_NAME) === null)
) {
const savedTheme = localStorage.getItem(LOCAL_STORAGE_KEY_NAME);
console.log('--- savedTheme ---');
console.log(savedTheme);

if (savedTheme && themeConfig.themes.includes(savedTheme)) {
return savedTheme;
Expand Down

0 comments on commit 118e553

Please sign in to comment.