mirror of
https://github.com/NohamR/gitprofile.git
synced 2026-05-25 04:17:13 +00:00
Merge pull request #99 from hasinhayder/main
Code Cleanup & Making code more readable
This commit is contained in:
@@ -69,7 +69,7 @@ export const ga = {
|
|||||||
// log specific events happening
|
// log specific events happening
|
||||||
event: ({ action, params }) => {
|
event: ({ action, params }) => {
|
||||||
try {
|
try {
|
||||||
typeof window !== 'undefined' && window.gtag('event', action, params);
|
window?.gtag('event', action, params);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error(error);
|
console.error(error);
|
||||||
}
|
}
|
||||||
@@ -77,217 +77,105 @@ export const ga = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const isThemeDarkish = (theme) => {
|
export const isThemeDarkish = (theme) => {
|
||||||
if (
|
return ['dark', 'halloween', 'forest', 'black', 'luxury', 'dracula'].includes(
|
||||||
theme === 'dark' ||
|
theme
|
||||||
theme === 'halloween' ||
|
);
|
||||||
theme === 'forest' ||
|
|
||||||
theme === 'black' ||
|
|
||||||
theme === 'luxury' ||
|
|
||||||
theme === 'dracula'
|
|
||||||
) {
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const setupHotjar = (hotjarConfig) => {
|
export const setupHotjar = (hotjarConfig) => {
|
||||||
if (hotjarConfig?.id) {
|
if (hotjarConfig?.id) {
|
||||||
let snippetVersion = hotjarConfig?.snippetVersion
|
let snippetVersion = hotjarConfig?.snippetVersion || 6;
|
||||||
? hotjarConfig?.snippetVersion
|
|
||||||
: 6;
|
|
||||||
|
|
||||||
hotjar.initialize(hotjarConfig.id, snippetVersion);
|
hotjar.initialize(hotjarConfig.id, snippetVersion);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export const sanitizeConfig = (config) => {
|
export const sanitizeConfig = (config) => {
|
||||||
const customTheme =
|
const customTheme = config?.themeConfig?.customTheme || {
|
||||||
typeof config.themeConfig !== 'undefined' &&
|
primary: '#fc055b',
|
||||||
typeof config.themeConfig.customTheme !== 'undefined'
|
secondary: '#219aaf',
|
||||||
? config.themeConfig.customTheme
|
accent: '#e8d03a',
|
||||||
: {
|
neutral: '#2A2730',
|
||||||
primary: '#fc055b',
|
'base-100': '#E3E3ED',
|
||||||
secondary: '#219aaf',
|
'--rounded-box': '3rem',
|
||||||
accent: '#e8d03a',
|
'--rounded-btn': '3rem',
|
||||||
neutral: '#2A2730',
|
};
|
||||||
'base-100': '#E3E3ED',
|
|
||||||
'--rounded-box': '3rem',
|
|
||||||
'--rounded-btn': '3rem',
|
|
||||||
};
|
|
||||||
|
|
||||||
const themes =
|
const themes = config?.themeConfig?.themes || [
|
||||||
typeof config.themeConfig !== 'undefined' &&
|
'light',
|
||||||
typeof config.themeConfig.themes !== 'undefined'
|
'dark',
|
||||||
? config.themeConfig.themes
|
'cupcake',
|
||||||
: [
|
'bumblebee',
|
||||||
'light',
|
'emerald',
|
||||||
'dark',
|
'corporate',
|
||||||
'cupcake',
|
'synthwave',
|
||||||
'bumblebee',
|
'retro',
|
||||||
'emerald',
|
'cyberpunk',
|
||||||
'corporate',
|
'valentine',
|
||||||
'synthwave',
|
'halloween',
|
||||||
'retro',
|
'garden',
|
||||||
'cyberpunk',
|
'forest',
|
||||||
'valentine',
|
'aqua',
|
||||||
'halloween',
|
'lofi',
|
||||||
'garden',
|
'pastel',
|
||||||
'forest',
|
'fantasy',
|
||||||
'aqua',
|
'wireframe',
|
||||||
'lofi',
|
'black',
|
||||||
'pastel',
|
'luxury',
|
||||||
'fantasy',
|
'dracula',
|
||||||
'wireframe',
|
'cmyk',
|
||||||
'black',
|
'autumn',
|
||||||
'luxury',
|
'business',
|
||||||
'dracula',
|
'acid',
|
||||||
'cmyk',
|
'lemonade',
|
||||||
'autumn',
|
'night',
|
||||||
'business',
|
'coffee',
|
||||||
'acid',
|
'winter',
|
||||||
'lemonade',
|
'procyon',
|
||||||
'night',
|
];
|
||||||
'coffee',
|
|
||||||
'winter',
|
|
||||||
'procyon',
|
|
||||||
];
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
github: {
|
github: {
|
||||||
username: config.github.username,
|
username: config.github.username,
|
||||||
sortBy:
|
sortBy: config.github.sortBy || 'stars',
|
||||||
typeof config.github.sortBy !== 'undefined'
|
limit: config.github.limit || 8,
|
||||||
? config.github.sortBy
|
|
||||||
: 'stars',
|
|
||||||
limit:
|
|
||||||
typeof config.github.limit !== 'undefined' ? config.github.limit : 8,
|
|
||||||
exclude: {
|
exclude: {
|
||||||
forks:
|
forks: config?.github?.exclude?.forks,
|
||||||
typeof config.github.exclude !== 'undefined' &&
|
projects: config?.github?.exclude?.projects || [],
|
||||||
typeof config.github.exclude.forks !== 'undefined'
|
|
||||||
? config.github.exclude.forks
|
|
||||||
: false,
|
|
||||||
projects:
|
|
||||||
typeof config.github.exclude !== 'undefined' &&
|
|
||||||
typeof config.github.exclude.projects !== 'undefined'
|
|
||||||
? config.github.exclude.projects
|
|
||||||
: [],
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
social: {
|
social: {
|
||||||
linkedin:
|
linkedin: config?.social?.twitter,
|
||||||
typeof config.social !== 'undefined' &&
|
twitter: config?.social?.twitter,
|
||||||
typeof config.social.linkedin !== 'undefined'
|
facebook: config?.social?.facebook,
|
||||||
? config.social.linkedin
|
instagram: config?.social?.instagram,
|
||||||
: '',
|
dribbble: config?.social?.dribble,
|
||||||
twitter:
|
behance: config?.social?.behance,
|
||||||
typeof config.social !== 'undefined' &&
|
medium: config?.social?.medium,
|
||||||
typeof config.social.twitter !== 'undefined'
|
dev: config?.social?.dev,
|
||||||
? config.social.twitter
|
website: config?.social?.website,
|
||||||
: '',
|
phone: config?.social?.phone,
|
||||||
facebook:
|
email: config?.social?.email,
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.facebook !== 'undefined'
|
|
||||||
? config.social.facebook
|
|
||||||
: '',
|
|
||||||
instagram:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.instagram !== 'undefined'
|
|
||||||
? config.social.instagram
|
|
||||||
: '',
|
|
||||||
dribbble:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.dribbble !== 'undefined'
|
|
||||||
? config.social.dribbble
|
|
||||||
: '',
|
|
||||||
behance:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.behance !== 'undefined'
|
|
||||||
? config.social.behance
|
|
||||||
: '',
|
|
||||||
medium:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.medium !== 'undefined'
|
|
||||||
? config.social.medium
|
|
||||||
: '',
|
|
||||||
dev:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.dev !== 'undefined'
|
|
||||||
? config.social.dev
|
|
||||||
: '',
|
|
||||||
website:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.website !== 'undefined'
|
|
||||||
? config.social.website
|
|
||||||
: '',
|
|
||||||
phone:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.phone !== 'undefined'
|
|
||||||
? config.social.phone
|
|
||||||
: '',
|
|
||||||
email:
|
|
||||||
typeof config.social !== 'undefined' &&
|
|
||||||
typeof config.social.email !== 'undefined'
|
|
||||||
? config.social.email
|
|
||||||
: '',
|
|
||||||
},
|
},
|
||||||
skills: typeof config.skills !== 'undefined' ? config.skills : [],
|
skills: config?.skills || [],
|
||||||
experiences:
|
experiences: config?.experiences || [],
|
||||||
typeof config.experiences !== 'undefined' ? config.experiences : [],
|
education: config?.education || [],
|
||||||
education: typeof config.education !== 'undefined' ? config.education : [],
|
|
||||||
blog: {
|
blog: {
|
||||||
source:
|
source: config?.blog?.source,
|
||||||
typeof config.blog !== 'undefined' &&
|
username: config?.blog?.username,
|
||||||
typeof config.blog.source !== 'undefined'
|
limit: config?.blog?.limit || 5,
|
||||||
? config.blog.source
|
|
||||||
: '',
|
|
||||||
username:
|
|
||||||
typeof config.blog !== 'undefined' &&
|
|
||||||
typeof config.blog.username !== 'undefined'
|
|
||||||
? config.blog.username
|
|
||||||
: '',
|
|
||||||
limit:
|
|
||||||
typeof config.blog !== 'undefined' &&
|
|
||||||
typeof config.blog.limit !== 'undefined'
|
|
||||||
? config.blog.limit
|
|
||||||
: 5,
|
|
||||||
},
|
},
|
||||||
googleAnalytics: {
|
googleAnalytics: {
|
||||||
id:
|
id: config?.googleAnalytics?.id,
|
||||||
typeof config.googleAnalytics !== 'undefined' &&
|
|
||||||
typeof config.googleAnalytics.id !== 'undefined'
|
|
||||||
? config.googleAnalytics.id
|
|
||||||
: '',
|
|
||||||
},
|
},
|
||||||
hotjar: {
|
hotjar: {
|
||||||
id:
|
id: config?.hotjar?.id,
|
||||||
typeof config.hotjar !== 'undefined' &&
|
snippetVersion: config?.hotjar?.snippetVersion || 6,
|
||||||
typeof config.hotjar.id !== 'undefined'
|
|
||||||
? config.hotjar.id
|
|
||||||
: '',
|
|
||||||
snippetVersion:
|
|
||||||
typeof config.hotjar !== 'undefined' &&
|
|
||||||
typeof config.hotjar.snippetVersion !== 'undefined'
|
|
||||||
? config.hotjar.snippetVersion
|
|
||||||
: 6,
|
|
||||||
},
|
},
|
||||||
themeConfig: {
|
themeConfig: {
|
||||||
defaultTheme:
|
defaultTheme: config?.themeConfig?.defaultTheme || themes[0],
|
||||||
typeof config.themeConfig !== 'undefined' &&
|
disableSwitch: config?.themeConfig?.disableSwitch,
|
||||||
typeof config.themeConfig.defaultTheme !== 'undefined'
|
respectPrefersColorScheme: config?.themeConfig?.respectPrefersColorScheme,
|
||||||
? config.themeConfig.defaultTheme
|
|
||||||
: themes[0],
|
|
||||||
disableSwitch:
|
|
||||||
typeof config.themeConfig !== 'undefined' &&
|
|
||||||
typeof config.themeConfig.disableSwitch !== 'undefined'
|
|
||||||
? config.themeConfig.disableSwitch
|
|
||||||
: false,
|
|
||||||
respectPrefersColorScheme:
|
|
||||||
typeof config.themeConfig !== 'undefined' &&
|
|
||||||
typeof config.themeConfig.respectPrefersColorScheme !== 'undefined'
|
|
||||||
? config.themeConfig.respectPrefersColorScheme
|
|
||||||
: false,
|
|
||||||
themes: themes,
|
themes: themes,
|
||||||
customTheme: customTheme,
|
customTheme: customTheme,
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user