Skip to content

Commit

Permalink
Merges pre-push git hooks from develop into main (#96)
Browse files Browse the repository at this point in the history
* [GIT SETUP] Tests pre push hook, disallowing direct push to develop
Problem
Solution
Note

* [GIT SETUP] Adds pre commit script
Problem
Solution
Note

* [GIT SETUP] Finalises pre commit hook script
Problem
Solution
Note

* [GIT SETUP] Changes git hook to pre push instead of pre commit
Problem
Solution
Note

* [GIT SETUP] Updates pre-push script comments
Problem
Solution
Note

* [GIT SETUP] Updates readme with git hook setup instructions
Problem
Solution
Note

* HOTFIX - Add Google Analytics (#97)

Co-authored-by: marcaufderheyde <[email protected]>

---------

Co-authored-by: Marc Auf der Heyde <[email protected]>
Co-authored-by: marcaufderheyde <[email protected]>
  • Loading branch information
3 people authored Jul 19, 2024
1 parent a4d3b9d commit 1efc5dd
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 9 deletions.
17 changes: 12 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
# The CCB Project

Main repository for cannabisclubsberlin.com, berlincannabisclubs.de and berlincannabisclubs.info

## The CCB Project
This is the project of Marc, Hector and Fabrizio. This is a webapp to discover new clubs in Berlin.

This is the project of Marc, Hector and Fabrizio. This is a webapp to discover new clubs in Berlin.

## Environment Requirements:

- NodeJS v20 (LTS): (https://nodejs.org/en)
- NPM
- NextJS
- NodeJS v20 (LTS): (https://nodejs.org/en)
- NPM
- NextJS

## Getting Started


First, install dependencies:

```bash
npm install
```

Next, run the setup scripts:

```bash
npm run prestart
```

Next, run the development server:

```bash
Expand Down
25 changes: 24 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { Inter } from 'next/font/google';
import 'leaflet/dist/leaflet.css';
import 'leaflet-defaulticon-compatibility/dist/leaflet-defaulticon-compatibility.webpack.css';
import './globals.css';
import Script from 'next/script';

const inter = Inter({ subsets: ['latin'] });

Expand All @@ -23,7 +24,29 @@ export default function RootLayout({
}>) {
return (
<html lang={locale}>
<body className={inter.className}>{children}</body>
<head>
<Script id="gtm-script" strategy="afterInteractive">
{`
(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-PBKDVXT9');
`}
</Script>
</head>
<body className={inter.className}>
{/* Google Tag Manager (noscript) */}
<noscript>
<iframe
src="https://www.googletagmanager.com/ns.html?id=GTM-PBKDVXT9"
height="0"
width="0"
style={{ display: 'none', visibility: 'hidden' }}
></iframe>
</noscript>
{children}
</body>
</html>
);
}
1 change: 1 addition & 0 deletions app/ui/Navigation/hamburgerbutton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export default function HamburgerButton({
>
<Burger
color={
// @ts-ignore
isPathnameHome(pathname)
? homeBurgerLineColor
: burgerLineColor
Expand Down
6 changes: 4 additions & 2 deletions app/ui/Navigation/links.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,26 @@ export default function Links({ links }: { links: Array<LinkInfo> }) {
'text-[#E3E71F] font-bold text-xl group transition duration-300';
const defaultLinkStyling =
'font-normal text-xl group transition duration-300';
// @ts-ignore
const isHomePage = isPathNameHome(pathname);

return (
<div className='flex flex-row justify-evenly flex-grow'>
<div className="flex flex-row justify-evenly flex-grow">
{links.map((link: LinkInfo) => {
return (
<Link
key={link.name}
href={link.href}
className={
// @ts-ignore
link.href.toString().includes(pathname) &&
!isHomePage
? currentPageStyling
: defaultLinkStyling
}
>
{link.name as String}
<span className='block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-green-600'></span>
<span className="block max-w-0 group-hover:max-w-full transition-all duration-500 h-0.5 bg-green-600"></span>
</Link>
);
})}
Expand Down
1 change: 1 addition & 0 deletions app/ui/Navigation/navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ export default function Navbar({ isOnMap = false }: Props) {
];

const pathname = usePathname();
// @ts-ignore
const fontColor = isPathNameHome(pathname)
? 'text-white'
: 'text-[#868686]';
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"build": "next build",
"postbuild": "node ./generate-sitemap.mjs",
"start": "next start",
"lint": "next lint"
"lint": "next lint",
"prestart": "cp scripts/pre-push .git/hooks/ && chmod +x .git/hooks/pre-push && echo 'hook copied'"
},
"dependencies": {
"globby": "^14.0.1",
Expand Down
23 changes: 23 additions & 0 deletions scripts/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/sh

echo "*****Running pre push build******"

cmd="npm run build"

#!/bin/bash

current_branch=$(git symbolic-ref HEAD | sed -e 's,.*/\(.*\),\1,')

if [ 'develop' = ${current_branch} ]
then
echo "ERROR: Cannot push to develop. Switch to a different branch and create a pull request."
exit 1 # push will not execute
else
eval $cmd
result=$?
if ! eval "$cmd"; then
echo "failed $cmd" >&2
exit 1
fi
fi
exit 0 # push will execute

0 comments on commit 1efc5dd

Please sign in to comment.