Skip to content

Commit

Permalink
feat: changement du style de la timeline [HOOK FAIL OK]
Browse files Browse the repository at this point in the history
  • Loading branch information
batleforc committed Aug 22, 2024
1 parent e2b7b1a commit 4e1109a
Show file tree
Hide file tree
Showing 7 changed files with 574 additions and 533 deletions.
20 changes: 20 additions & 0 deletions apps/front/src/helper/mediaQuerry.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { computed, onMounted, onUnmounted, ref } from 'vue';

export const useBreakpoints = () => {
const windowWidth = ref(window.innerWidth);

const onWidthChange = () => (windowWidth.value = window.innerWidth);
onMounted(() => window.addEventListener('resize', onWidthChange));
onUnmounted(() => window.removeEventListener('resize', onWidthChange));

const type = computed(() => {
if (windowWidth.value < 680) return 'xs';
if (windowWidth.value >= 680 && windowWidth.value < 1200) return 'md';
if (windowWidth.value >= 1200) return 'lg';
return null; // This is an unreachable line, simply to keep eslint happy.
});

const width = computed(() => windowWidth.value);

return { width, type };
};
13 changes: 10 additions & 3 deletions apps/front/src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
import { useIndexStore } from '../stores';
import { getMediaApiUrl } from '../helper/index';
import IcoOrMedia from '../component/helper/IcoOrMedia.vue';
import { useBreakpoints } from '../helper/mediaQuerry';
const indexStore = useIndexStore();
const { type } = useBreakpoints();
</script>

<template>
Expand All @@ -17,9 +19,10 @@ const indexStore = useIndexStore();
</a>
</div>
<div>
<Timeline :value="indexStore.getHistory" align="alternate" class="w-full p-2">
<Timeline :value="indexStore.getHistory" :align="type == 'xs' ? 'left' : 'alternate'"
class="w-full px-2 py-5 customized-timeline" :class="type == 'xs' ? 'justify-end' : ''">
<template #content="slotProps">
<Card>
<Card class="min-w-64">
<template #header>
<div class="flex justify-center">
<img :src="getMediaApiUrl(slotProps.item.imgUrl)" alt="img" class="w-20 h-20" />
Expand Down Expand Up @@ -57,4 +60,8 @@ const indexStore = useIndexStore();
.homePageCvContainer {
@apply my-8 flex justify-center;
}
</style>
.p-timeline-event-content {
@apply pb-10;
}
</style>
3 changes: 3 additions & 0 deletions cog.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,8 @@ authors = [
[git_hooks.commit-msg]
script = """#!/bin/sh
set -e
commit_msg=$(cat "${1:?Missing commit message file}")
echo $commit_msg
export COMMIT_MSG=$commit_msg
nx run-many -t hook --verbose
"""
20 changes: 15 additions & 5 deletions libs/hook/src/executors/hook:rust/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { exec } from 'child_process';
import { promisify } from 'util';

const runExecutor: PromiseExecutor<HookRustExecutorSchema> = async (
options
options,
) => {
console.info('Running Rust hook for', options['target-dir']);
const hookCommand = [
Expand All @@ -14,10 +14,20 @@ const runExecutor: PromiseExecutor<HookRustExecutorSchema> = async (
'gitleaks protect --verbose --redact --staged',
];
const command = hookCommand.join(' && ');
await promisify(exec)(command).then((result) => {
console.log(result.stdout);
console.log(result.stderr);
});
await promisify(exec)(command)
.then((result) => {
console.log(result.stdout);
console.log(result.stderr);
})
.catch((err) => {
console.error('Error running command', command);
console.log(err);
if (process.env.COMMIT_MSG.includes('[HOOK FAIL OK]'))
return { success: true };
return {
success: false,
};
});
return {
success: true,
};
Expand Down
5 changes: 4 additions & 1 deletion libs/hook/src/executors/hook:vue/executor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const runExecutor: PromiseExecutor<HookVueExecutorSchema> = async (options) => {
console.info('Running Vue hook for', options['target-dir']);
const hookCommand = ['nx lint front', 'yarn audit'];
const command = hookCommand.join(' && ');

return await promisify(exec)(command)
.then((result) => {
console.log(result.stdout);
Expand All @@ -17,7 +18,9 @@ const runExecutor: PromiseExecutor<HookVueExecutorSchema> = async (options) => {
})
.catch((err) => {
console.error('Error running command', command);
console.error(err);
console.log(err);
if (process.env.COMMIT_MSG.includes('[HOOK FAIL OK]'))
return { success: true };
return {
success: false,
};
Expand Down
30 changes: 15 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,23 +21,23 @@
},
"devDependencies": {
"@monodon/rust": "^2.0.0-beta.1",
"@nx/cypress": "19.5.7",
"@nx/devkit": "19.5.7",
"@nx/eslint": "19.5.7",
"@nx/eslint-plugin": "19.5.7",
"@nx/jest": "19.5.7",
"@nx/js": "19.5.7",
"@nx/plugin": "19.5.7",
"@nx/vite": "19.5.7",
"@nx/vue": "19.5.7",
"@nx/web": "19.5.7",
"@nx/workspace": "19.5.7",
"@nx/cypress": "19.6.2",
"@nx/devkit": "19.6.2",
"@nx/eslint": "19.6.2",
"@nx/eslint-plugin": "19.6.2",
"@nx/jest": "19.6.2",
"@nx/js": "19.6.2",
"@nx/plugin": "19.6.2",
"@nx/vite": "19.6.2",
"@nx/vue": "19.6.2",
"@nx/web": "19.6.2",
"@nx/workspace": "19.6.2",
"@primevue/auto-import-resolver": "^4.0.4",
"@swc-node/register": "~1.9.1",
"@swc/cli": "~0.3.12",
"@swc/core": "~1.5.7",
"@swc/helpers": "~0.5.11",
"@types/jest": "^29.4.0",
"@types/jest": "29.5.12",
"@types/node": "18.16.9",
"@typescript-eslint/eslint-plugin": "7.18.0",
"@typescript-eslint/parser": "7.18.0",
Expand All @@ -53,10 +53,10 @@
"eslint-config-prettier": "^9.0.0",
"eslint-plugin-cypress": "^2.13.4",
"eslint-plugin-vue": "^9.16.1",
"jest": "^29.4.1",
"jest-environment-jsdom": "^29.4.1",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"jsdom": "~24.1.1",
"nx": "19.5.7",
"nx": "19.6.2",
"postcss": "^8.4.41",
"prettier": "^3.3.3",
"sass": "1.62.1",
Expand Down
Loading

0 comments on commit 4e1109a

Please sign in to comment.