Skip to content

Commit 8b27c2d

Browse files
authored
Merge pull request #23 from Akshay-Vs/spa
Spa
2 parents 0a6c268 + 2f1c5c2 commit 8b27c2d

33 files changed

+482
-87
lines changed

apps/web/app/globals.scss

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
@tailwind components;
33
@tailwind utilities;
44

5+
@import '../styles/button.scss';
6+
57
// global variables
68
$background: #ebeced;
79
$stroke: #919091;
@@ -29,6 +31,28 @@ body {
2931
// min-width: 100vw;
3032
}
3133

34+
.horizontal-scroll::-webkit-scrollbar {
35+
height: 0px;
36+
}
37+
38+
.horizontal-scroll {
39+
-ms-overflow-style: none;
40+
-moz-scrollbar-width: none;
41+
scrollbar-width: none;
42+
}
43+
44+
::-webkit-scrollbar-track {
45+
background: #f1f1f1;
46+
}
47+
48+
::-webkit-scrollbar-thumb {
49+
background: #888;
50+
}
51+
52+
::-webkit-scrollbar-thumb:hover {
53+
background: #555;
54+
}
55+
3256
.center {
3357
@apply flex justify-center items-center;
3458
}
@@ -70,5 +94,5 @@ body {
7094
}
7195

7296
.main-container {
73-
@apply w-full flex flex-col justify-center items-center gap-4 px-[5%];
97+
@apply w-full flex justify-center items-center gap-4 px-[5%];
7498
}

apps/web/app/layout.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
import type { Metadata } from 'next';
21
import { Geist, Jost } from 'next/font/google';
32

43
import '@proximity/ui/styles.css';
54
import './globals.scss';
5+
import { myMetadata, myViewport } from '@/pwa';
66

77
const geistSans = Geist({
88
variable: '--font-geist-sans',
@@ -14,10 +14,8 @@ const jost = Jost({
1414
subsets: ['latin'],
1515
});
1616

17-
export const metadata: Metadata = {
18-
title: 'Create Next App',
19-
description: 'Generated by create next app',
20-
};
17+
export const metadata = myMetadata;
18+
export const viewport = myViewport;
2119

2220
const RootLayout = ({
2321
children,

apps/web/app/manifest.webmanifest

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
{
2+
"theme_color": "#FFFFFF",
3+
"background_color": "#FFFFFF",
4+
"display": "standalone",
5+
"scope": "/",
6+
"start_url": "/",
7+
"name": "Proximity",
8+
"short_name": "Proximity",
9+
"description": "News App",
10+
"icons": [
11+
{
12+
"src": "/icon-192x192.png",
13+
"sizes": "192x192",
14+
"type": "image/png"
15+
},
16+
{
17+
"src": "/icon-256x256.png",
18+
"sizes": "256x256",
19+
"type": "image/png"
20+
},
21+
{
22+
"src": "/icon-384x384.png",
23+
"sizes": "384x384",
24+
"type": "image/png"
25+
},
26+
{
27+
"src": "/icon-512x512.png",
28+
"sizes": "512x512",
29+
"type": "image/png"
30+
}
31+
],
32+
"id": "com.archivematrix.proximity.xi",
33+
"lang": "en",
34+
"orientation": "portrait",
35+
"display_override": ["standalone", "window-controls-overlay", "browser"],
36+
"dir": "auto",
37+
"categories": ["news"]
38+
}

apps/web/app/page.tsx

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,26 @@
1-
import ScreenMain from '@/components/shared/wrapper/screen-main';
1+
import Header from '@/components/specific/header/nav-header';
2+
import Featured from '@/components/specific/news/featured/featured';
3+
import SearchBar from '@/components/specific/search-bar/search-bar';
4+
import Tags from '@/components/specific/tags/tags';
5+
6+
import testArticle from '@/public/images/image 2.png';
27

38
const Home = () => {
4-
return <ScreenMain />;
9+
return (
10+
<main className="w-full h-full flex flex-col gap-6 justify-center items-center">
11+
<div className="w-full h-full flex flex-col gap-6 justify-center items-center pb-2">
12+
<Header />
13+
<Featured
14+
title="Musk's $56bn deal rejected"
15+
description="Tesla chief executive Elon Musk's record-breaking $56bn (£47bn) pay award will not be reinstated, a judge has ruled"
16+
image={testArticle}
17+
/>
18+
</div>
19+
20+
<SearchBar />
21+
<Tags />
22+
</main>
23+
);
524
};
625

726
export default Home;

apps/web/app/sw.ts

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/* eslint-disable @typescript-eslint/no-explicit-any */
2+
import { defaultCache } from '@serwist/next/worker';
3+
import type { PrecacheEntry, SerwistGlobalConfig } from 'serwist';
4+
import { Serwist } from 'serwist';
5+
6+
// This declares the value of `injectionPoint` to TypeScript.
7+
// `injectionPoint` is the string that will be replaced by the
8+
// actual precache manifest. By default, this string is set to
9+
// `"self.__SW_MANIFEST"`.
10+
declare global {
11+
interface WorkerGlobalScope extends SerwistGlobalConfig {
12+
addEventListener(arg0: string, arg1: (event: any) => void): unknown;
13+
clients: any;
14+
__SW_MANIFEST: (PrecacheEntry | string)[] | undefined;
15+
}
16+
}
17+
18+
19+
declare const self: WorkerGlobalScope;
20+
21+
const serwist = new Serwist({
22+
23+
precacheEntries: self.__SW_MANIFEST,
24+
skipWaiting: true,
25+
clientsClaim: true,
26+
navigationPreload: true,
27+
runtimeCaching: defaultCache,
28+
});
29+
30+
serwist.addEventListeners();

apps/web/components/shared/wrapper/screen-main.tsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

apps/web/components/specific/news/featured/featured.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface FeaturedProps {
1111

1212
const Featured = ({ title, description, image }: FeaturedProps) => {
1313
return (
14-
<article className="main-container">
14+
<article className="main-container flex-col">
1515
<FeaturedTitle title={title} />
1616
<div className="center gap-4">
1717
<FeaturedImage image={image} />
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
import { Button } from '@proximity/ui/shadcn/button';
2+
3+
interface TagButtonEnhancedProps {
4+
label: string;
5+
}
6+
7+
const TagButtonEnhanced = ({ label }: TagButtonEnhancedProps) => {
8+
return (
9+
<Button variant="tag" className="h-12 px-7 center button__enhanced">
10+
<div className="z-10 center gap-2">
11+
<svg
12+
fill="none"
13+
xmlns="http://www.w3.org/2000/svg"
14+
viewBox="0 0 16 16"
15+
className="scale-125"
16+
>
17+
<path
18+
d="M16 8.016A8.522 8.522 0 008.016 16h-.032A8.521 8.521 0 000 8.016v-.032A8.521 8.521 0 007.984 0h.032A8.522 8.522 0 0016 7.984v.032z"
19+
fill="url(#prefix__paint0_radial_980_20147)"
20+
/>
21+
<defs>
22+
<radialGradient
23+
id="prefix__paint0_radial_980_20147"
24+
cx="0"
25+
cy="0"
26+
r="1"
27+
gradientUnits="userSpaceOnUse"
28+
gradientTransform="matrix(16.1326 5.4553 -43.70045 129.2322 1.588 6.503)"
29+
>
30+
<stop offset=".067" stopColor="#9168C0" />
31+
<stop offset=".343" stopColor="#5684D1" />
32+
<stop offset=".672" stopColor="#1BA1E3" />
33+
</radialGradient>
34+
</defs>
35+
</svg>
36+
37+
{label}
38+
</div>
39+
</Button>
40+
);
41+
};
42+
43+
export default TagButtonEnhanced;
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
import { Button } from '@proximity/ui/shadcn/button';
2+
3+
interface TagButtonPrimaryProps {
4+
label: string;
5+
}
6+
7+
const TagButtonPrimary = ({ label }: TagButtonPrimaryProps) => {
8+
return (
9+
<Button variant="tag" className="h-12 px-7">
10+
{label}
11+
</Button>
12+
);
13+
};
14+
15+
export default TagButtonPrimary;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import TagButtonPrimary from './tag-button-primary';
2+
import TagButtonEnhanced from './tag-button-enhanced';
3+
4+
const Tags = () => {
5+
return (
6+
<div className="w-full flex justify-center items-center gap-4 relative">
7+
<div className="absolute top-0 left-0 w-[7%] z-20 h-full bg-gradient-to-r from-[#ebeced] via-[#ebecedab] to-[#ebeced00]" />
8+
<div className="absolute top-0 right-0 w-[7%] z-20 h-full bg-gradient-to-r from-[#ebeced00] via-[#ebecedab] to-[#ebeced]" />
9+
10+
<div className="flex items-center gap-4 w-full overflow-y-hidden overflow-x-scroll horizontal-scroll px-[5%]">
11+
<TagButtonEnhanced label="For You" />
12+
<TagButtonPrimary label="Technology" />
13+
<TagButtonPrimary label="Space" />
14+
<TagButtonPrimary label="Finance" />
15+
</div>
16+
</div>
17+
);
18+
};
19+
20+
export default Tags;

apps/web/hooks/use-screen.ts

Lines changed: 0 additions & 18 deletions
This file was deleted.

apps/web/next.config.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
1-
import type { NextConfig } from "next";
1+
import withSerwistInit from '@serwist/next';
22

3-
const nextConfig: NextConfig = {
4-
/* config options here */
5-
};
3+
const withSerwist = withSerwistInit({
4+
swSrc: 'app/sw.ts',
5+
swDest: 'public/sw.js',
6+
});
67

7-
export default nextConfig;
8+
const nextConfig = {};
9+
10+
export default withSerwist(nextConfig);

apps/web/package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,14 @@
1111
"dependencies": {
1212
"@proximity/tailwind-config": "workspace:*",
1313
"@proximity/ui": "workspace:*",
14+
"@serwist/next": "^9.0.11",
1415
"lucide-react": "^0.468.0",
1516
"next": "15.1.2",
1617
"react": "^19.0.0",
1718
"react-dom": "^19.0.0",
1819
"sass": "^1.83.0",
20+
"serwist": "^9.0.11",
21+
"worker": "link:@serwist/next/worker",
1922
"zod": "^3.24.1",
2023
"zustand": "^5.0.2"
2124
},

apps/web/public/icon-192x192.png

4.14 KB
Loading

apps/web/public/icon-256x256.png

6.08 KB
Loading

apps/web/public/icon-384x384.png

10.4 KB
Loading

apps/web/public/icon-512x512.png

15 KB
Loading
63.7 KB
Loading
26.9 KB
Loading

apps/web/pwa/index.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { myMetadata } from './metadata';
2+
import { myViewport } from './viewport';
3+
4+
export { myMetadata, myViewport };

apps/web/pwa/metadata.ts

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { Metadata } from 'next';
2+
3+
const APP_NAME = 'Proximity';
4+
const APP_DEFAULT_TITLE = 'Proximity';
5+
const APP_TITLE_TEMPLATE = '%s - PWA App';
6+
const APP_DESCRIPTION = 'News App';
7+
8+
export const myMetadata: Metadata = {
9+
applicationName: APP_NAME,
10+
title: {
11+
default: APP_DEFAULT_TITLE,
12+
template: APP_TITLE_TEMPLATE,
13+
},
14+
description: APP_DESCRIPTION,
15+
manifest: '/manifest.json',
16+
appleWebApp: {
17+
capable: true,
18+
statusBarStyle: 'default',
19+
title: APP_DEFAULT_TITLE,
20+
// startUpImage: [],
21+
},
22+
formatDetection: {
23+
telephone: false,
24+
},
25+
openGraph: {
26+
type: 'website',
27+
siteName: APP_NAME,
28+
title: {
29+
default: APP_DEFAULT_TITLE,
30+
template: APP_TITLE_TEMPLATE,
31+
},
32+
description: APP_DESCRIPTION,
33+
},
34+
twitter: {
35+
card: 'summary',
36+
title: {
37+
default: APP_DEFAULT_TITLE,
38+
template: APP_TITLE_TEMPLATE,
39+
},
40+
description: APP_DESCRIPTION,
41+
},
42+
};

apps/web/pwa/viewport.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { Viewport } from 'next';
2+
3+
export const myViewport: Viewport = {
4+
themeColor: '#F6FEFE',
5+
};

0 commit comments

Comments
 (0)