Skip to content

Commit

Permalink
Merge pull request #44 from acayseth/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
acayseth committed Aug 21, 2023
2 parents b844ec9 + 3a10008 commit 11e9759
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 29 deletions.
3 changes: 1 addition & 2 deletions .github/workflows/docker-image-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:
token: ${{ secrets.TOKEN }}
- name: Build the Docker image
run: |
echo "NEXT_PUBLIC_PROJECT_URL=${{ secrets.NEXT_PUBLIC_PROJECT_URL }}" >> .env
echo "NEXT_PUBLIC_GA_ID=${{ secrets.NEXT_PUBLIC_GA_ID }}" >> .env
echo "NEXT_PUBLIC_PROJECT_URL=${{ secrets.NEXT_PUBLIC_PROJECT_URL }}" >> .env
echo "GIPHY_API_KEY=${{ secrets.GIPHY_API_KEY }}" >> .env
echo "GIPHY_RATING=${{ secrets.GIPHY_RATING }}" >> .env
echo "GIPHY_TAG_IS_FRIDAY=${{ secrets.GIPHY_TAG_IS_FRIDAY }}" >> .env
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/docker-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ jobs:
token: ${{ secrets.TOKEN }}
- name: Build the Docker image
run: |
echo "NEXT_PUBLIC_PROJECT_URL=${{ secrets.NEXT_PUBLIC_PROJECT_URL }}" >> .env
echo "NEXT_PUBLIC_GA_ID=${{ secrets.NEXT_PUBLIC_GA_ID }}" >> .env
echo "NEXT_PUBLIC_PROJECT_URL=${{ secrets.NEXT_PUBLIC_PROJECT_URL }}" >> .env
echo "GIPHY_API_KEY=${{ secrets.GIPHY_API_KEY }}" >> .env
echo "GIPHY_RATING=${{ secrets.GIPHY_RATING }}" >> .env
echo "GIPHY_TAG_IS_FRIDAY=${{ secrets.GIPHY_TAG_IS_FRIDAY }}" >> .env
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"react-countdown": "^2.3.5",
"react-dom": "18.2.0",
"react-icons": "^4.10.1",
"schema-dts": "^1.1.2",
"server-only": "^0.0.1"
},
"devDependencies": {
Expand Down
12 changes: 6 additions & 6 deletions src/_libs/servers/helper.hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@ interface IFetchGiphyProps {
}

export function userHelperHook() {
const fetchGiphy = async ({ id = 'random' }: IFetchGiphyProps) => {

const fetchGiphy = async ({ id = 'random' }: IFetchGiphyProps): Promise<IGiphy> => {
const r = await fetch(`https://api.giphy.com/v1/gifs/${id}?${decodeURIComponent(new URLSearchParams({
api_key: process.env.GIPHY_API_KEY as string,
rating: process.env.GIPHY_RATING as string,
tag: (moment().day() === 5 ? process.env.GIPHY_TAG_IS_FRIDAY as string : process.env.GIPHY_TAG_IS_NOT_FRIDAY as string),
}).toString())}`, { cache: 'no-store' });
return await r.json();
};

const metadata = async ({ id, robots }: IMetadataProps): Promise<Metadata> => {
const description: string = 'Vinerea este în mod tradițional a cincea zi a săptămânii (pentru țările în care săptămâna începe lunea), care cade între zilele de joi și sâmbătă. Etimologie: Veneris dies (l.lat.) = Ziua zeiței Venus.';
let giphy: IGiphy | undefined = undefined;
let videos: any | null = null;

if (id) {
giphy = await fetchGiphy({ id });
videos = [
Expand All @@ -44,7 +44,7 @@ export function userHelperHook() {
},
];
}

return {
title: 'Îi vineri?',
description: EDaysOfWeek[moment().day()],
Expand All @@ -69,7 +69,7 @@ export function userHelperHook() {
],
};
};

return {
metadata,
fetchGiphy,
Expand Down
22 changes: 19 additions & 3 deletions src/app/page.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
import 'server-only';

import { Product, WithContext } from 'schema-dts'
import type { Metadata } from 'next';

import { userHelperHook } from '@/_libs/servers/helper.hook';
import HomeComponent from '@/components/pages/home/home.component';

export function generateMetadata(): Promise<Metadata> {
const { metadata } = userHelperHook();

return metadata({ robots: true });
}

export default async function () {
const { fetchGiphy } = userHelperHook();
const giphy = await fetchGiphy({});

return <HomeComponent giphy={giphy} />;

console.log(giphy, 'gp')

const jsonLd: WithContext<Product> = {
'@context': 'https://schema.org',
'@type': 'Product',
name: 'random gif',
image: giphy?.data?.images?.original_mp4.mp4,
description: 'random gif',
}

return (
<>
<HomeComponent giphy={giphy} />
<script type="application/ld+json" dangerouslySetInnerHTML={{ __html: JSON.stringify(jsonLd) }}/>
</>
);
}
4 changes: 2 additions & 2 deletions src/components/pages/home/home.component.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import React from 'react';
import DayOfWeekComponent from '@/components/ui/day-of-week/day-of-week.component';
import DayOfWeeksComponent from '@/components/ui/day-of-week/day-of-weeks.component';
import CountDownComponent from '@/components/ui/count-down/count-down.component';
import TimelineComponent from '@/components/ui/timeline/timeline.component';
import TimelineListComponent from '@/components/ui/timeline/timeline-list.component';

import type { IGiphy } from '@/types/interfaces/giphy';

Expand All @@ -21,7 +21,7 @@ export default function HomeComponent({ giphy }: IProps) {
<DayOfWeekComponent />
<CountDownComponent />
<GiphyComponent giphy={giphy} />
<TimelineComponent />
<TimelineListComponent />
</>
);
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
'use client';

import React from 'react';

interface IProps {
date: string;
message: string;
Expand All @@ -14,25 +13,29 @@ const timelines = [
{ date: '2012', message: 'Realizat cu ajutorul tehnologiilor extraordinar de avansate: Spring, Hibernate, HTML5, JMS, EhCache.' },
];

export default function TimelineComponent() {
export default function TimelineListComponent() {
return (
<section className="flex flex-col rounded-xl transition-all shadown-sm shadow-gray-400/10 bg-neutral-800/90 bg-clip-border text-gray-700 shadow-md my-2 py-2">
<div className="flex flex-col rounded-xl transition-all shadown-sm shadow-gray-400/10 bg-neutral-800/90 bg-clip-border text-gray-700 shadow-md my-2 py-2">
<div className="relative m-2 object-scale-down overflow-hidden rounded-xl">
<ol className="border-l border-neutral-300 dark:border-neutral-500">
{timelines.map((timeline, index) => (
<TimeLap key={index} date={timeline.date} message={timeline.message} />
<TimeLap
key={index}
date={timeline.date}
message={timeline.message}
/>
))}
</ol>
</div>
</section>
</div>
);
}

function TimeLap({ date, message }: IProps) {
return (
<li>
<div className="flex-start flex items-center pt-0.5">
<div className="-ml-[5px] mr-3 h-[9px] w-[9px] rounded-full bg-white"></div>
<div className="-ml-[5px] mr-3 h-[9px] w-[9px] rounded-full bg-white"></div>
<p className="text-sm text-neutral-500 dark:text-neutral-300">{date}</p>
</div>
<div className="mb-3 ml-4 mt-1">
Expand Down
4 changes: 2 additions & 2 deletions src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ import { NextResponse } from 'next/server';

export const config = {
matcher: [
'/((?!api|_next|icons|favicon.ico|manifest.json).*)',
'/((?!api|_next|icons|favicon.ico|sw.js|manifest.json).*)',
],
};

export default function middleware(req: NextRequest, res: NextResponse) {
export default function middleware(req: NextRequest) {
const { pathname } = req.nextUrl.clone();
console.log('middleware =>', pathname);

Expand Down
17 changes: 11 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -322,9 +322,9 @@ camelcase-css@^2.0.1:
integrity sha512-QOSvevhslijgYwRx6Rv7zKdMF8lbRmx+uQGx2+vDc+KI/eBnsy9kit5aj23AgGu3pa4t9AgwbnXWqS+iOY+2aA==

caniuse-lite@^1.0.30001406, caniuse-lite@^1.0.30001464, caniuse-lite@^1.0.30001517:
version "1.0.30001519"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001519.tgz#3e7b8b8a7077e78b0eb054d69e6edf5c7df35601"
integrity sha512-0QHgqR+Jv4bxHMp8kZ1Kn8CH55OikjKJ6JmKkZYP1F3D7w+lnFXF70nG5eNfsZS89jadi5Ywy5UCSKLAglIRkg==
version "1.0.30001520"
resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001520.tgz#62e2b7a1c7b35269594cf296a80bdf8cb9565006"
integrity sha512-tahF5O9EiiTzwTUqAeFjIZbn4Dnqxzz7ktrgGlMYNLH43Ul26IgTMH/zvL3DG0lZxBYnlT04axvInszUsZULdA==

chokidar@^3.5.3:
version "3.5.3"
Expand Down Expand Up @@ -857,9 +857,9 @@ next@13.4.9:
"@next/swc-win32-x64-msvc" "13.4.9"

node-abi@^3.3.0:
version "3.45.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.45.0.tgz#f568f163a3bfca5aacfce1fbeee1fa2cc98441f5"
integrity sha512-iwXuFrMAcFVi/ZoZiqq8BzAdsLw9kxDfTC0HMyjXfSL/6CSDAGD5UmR7azrAgWV1zKYq7dUUMj4owusBWKLsiQ==
version "3.46.0"
resolved "https://registry.yarnpkg.com/node-abi/-/node-abi-3.46.0.tgz#491adaa8d227ca9702f30b27b2b6b248caa1348f"
integrity sha512-LXvP3AqTIrtvH/jllXjkNVbYifpRbt9ThTtymSMSuHmhugQLAWr99QQFTm+ZRht9ziUvdGOgB+esme1C6iE6Lg==
dependencies:
semver "^7.3.5"

Expand Down Expand Up @@ -1169,6 +1169,11 @@ scheduler@^0.23.0:
dependencies:
loose-envify "^1.1.0"

schema-dts@^1.1.2:
version "1.1.2"
resolved "https://registry.yarnpkg.com/schema-dts/-/schema-dts-1.1.2.tgz#82ccf71b5dcb80065a1cc5941888507a4ce1e44b"
integrity sha512-MpNwH0dZJHinVxk9bT8XUdjKTxMYrA5bLtrrGmFA6PTLwlOKnhi67XoRd6/ty+Djt6ZC0slR57qFhZDNMI6DhQ==

semver@^7.3.5, semver@^7.5.4:
version "7.5.4"
resolved "https://registry.yarnpkg.com/semver/-/semver-7.5.4.tgz#483986ec4ed38e1c6c48c34894a9182dbff68a6e"
Expand Down

0 comments on commit 11e9759

Please sign in to comment.