Skip to content

Commit

Permalink
Merge pull request #699 from bamdadfr/next/bamdad
Browse files Browse the repository at this point in the history
  • Loading branch information
bamdadfr authored Oct 9, 2024
2 parents 88c7072 + 7f2b608 commit cee15df
Show file tree
Hide file tree
Showing 44 changed files with 303 additions and 395 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -192,5 +192,6 @@ module.exports = {
],
},
],
'import/consistent-type-specifier-style': ['error', 'prefer-inline'],
},
};
21 changes: 17 additions & 4 deletions next.config.js → next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const {withSentryConfig} = require('@sentry/nextjs');
import {withSentryConfig} from '@sentry/nextjs';

const isEnvProduction = process.env.NODE_ENV === 'production';

const configuration = {
Expand All @@ -7,7 +8,14 @@ const configuration = {
styledComponents: true,
},
images: {
domains: ['api.screwmycode.in'],
remotePatterns: [
{
protocol: 'https',
hostname: 'api.screwmycode.in',
port: '',
pathname: '/**',
},
],
},
webpack: (config) => {
config = {
Expand All @@ -28,8 +36,13 @@ const configuration = {
};

if (!isEnvProduction) {
configuration.images.domains = [...configuration.images.domains, 'localhost'];
configuration.images.remotePatterns.push({
protocol: 'http',
hostname: 'localhost',
port: '8000',
pathname: '/**',
});
}

const SentryWebpackPluginOptions = {};
module.exports = withSentryConfig(configuration, SentryWebpackPluginOptions);
export default withSentryConfig(configuration, SentryWebpackPluginOptions);
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@
"jotai": "^2.10.0",
"next": "^14.2.14",
"next-replace-url": "^1.0.3",
"next-seo": "^6.6.0",
"next-sitemap": "^4.2.3",
"raf": "^3.4.1",
"react": "^18.3.1",
"react-device-detect": "^2.2.3",
Expand Down Expand Up @@ -98,7 +100,6 @@
"eslint-plugin-testing-library": "^6.3.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"next-sitemap": "^4.2.3",
"prettier": "^3.3.3",
"rimraf": "^6.0.1",
"sass": "^1.79.4",
Expand Down
22 changes: 19 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/animations/fade/fade.animation.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {animated, useSpring} from '@react-spring/web';
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

interface FadeAnimationProps {
children: string | ReactElement;
Expand Down
2 changes: 1 addition & 1 deletion src/app/components/theme-wrapper/theme-wrapper.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';
import {Global} from 'src/app/styles/global';
import {theme} from 'src/app/styles/theme';
import {ThemeProvider} from 'styled-components';
Expand Down
22 changes: 12 additions & 10 deletions src/components/audio/audio.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

import {Invisible} from './audio.component.styles';
import {useAudioModule} from './hooks/use-audio-component';
Expand All @@ -11,14 +11,16 @@ export function AudioComponent({url}: Props): ReactElement {
const {ref} = useAudioModule(url);

return (
<Invisible>
<audio
ref={ref}
aria-label="player"
// controls
>
<track kind="captions" />
</audio>
</Invisible>
<>
<Invisible>
<audio
ref={ref}
aria-label="player"
// controls
>
<track kind="captions" />
</audio>
</Invisible>
</>
);
}
23 changes: 1 addition & 22 deletions src/components/audio/hooks/use-audio-component.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
import {useAtom} from 'jotai';
import {useRouter} from 'next/router';
import {useNextReplaceUrl} from 'next-replace-url';
import {RefObject, useRef} from 'react';
import {audioTitleAtom} from 'src/atoms/audio-title.atoms';
import {speedAtom} from 'src/atoms/speed.atoms';
import {useCache} from 'src/hooks/use-cache';
import {getProviderFromRouter} from 'src/utils/get-provider/get-provider-from-router';
import {type RefObject, useRef} from 'react';

import {useAudioBuffered} from './use-audio-buffered';
import {useAudioLoad} from './use-audio-load';
Expand All @@ -22,23 +15,9 @@ interface UseAudioComponent {
ref: RefObject<HTMLAudioElement>;
}

/**
* Entry hook for the audio module
*/
export function useAudioModule(url: string): UseAudioComponent {
const router = useRouter();
const [speed] = useAtom(speedAtom);
const [audioTitle] = useAtom(audioTitleAtom);
const cachedSpeed = useCache(speed, 350);

useKeyboardToggle('Space');

useNextReplaceUrl('speed', cachedSpeed.toString());

if (audioTitle) {
document.title = `${audioTitle} - ${cachedSpeed} - ${getProviderFromRouter(router)}`;
}

const ref = useRef<HTMLAudioElement>(null);

useAudioLoad(ref.current, url);
Expand Down
10 changes: 8 additions & 2 deletions src/components/form/form.component.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import Image from 'next/legacy/image';
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

import {Form, GoogleContainer, ImageContainer, Input, Submit} from './form.component.styles';
import {
Form,
GoogleContainer,
ImageContainer,
Input,
Submit,
} from './form.component.styles';
import {useFormComponent} from './hooks/use-form-component';

/**
Expand Down
2 changes: 1 addition & 1 deletion src/components/indicators/indicators.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

import {IndicatorComponent} from './components/indicator/indicator.component';
import {useIndicatorsComponent} from './hooks/use-indicators-component';
Expand Down
2 changes: 1 addition & 1 deletion src/components/loading/components/dots/dots.component.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

import {useDotsComponent} from './hooks/use-dots-component';

Expand Down
1 change: 1 addition & 0 deletions src/components/loading/loading.component.styles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const ImageContainer = styled.div`
height: 10em;
transform: translate3d(-${p}px, -${p * 4}px, 0);
position: relative;
`;

export const Text = styled.span`
Expand Down
6 changes: 2 additions & 4 deletions src/components/loading/loading.component.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import Image from 'next/legacy/image';
import React, {ReactElement} from 'react';
import React, {type ReactElement} from 'react';

import {DotsComponent} from './components/dots/dots.component';
import {Container, ImageContainer, Text} from './loading.component.styles';

/**
* Component for the loading screen
*/
export function LoadingComponent(): ReactElement {
return (
<Container>
Expand All @@ -16,6 +13,7 @@ export function LoadingComponent(): ReactElement {
alt="filling glass"
layout="fill"
objectFit="contain"
priority
/>
</ImageContainer>

Expand Down
123 changes: 0 additions & 123 deletions src/components/meta/meta.component.test.js

This file was deleted.

Loading

0 comments on commit cee15df

Please sign in to comment.