-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from hyperse-io/feat/track
Feat/track
- Loading branch information
Showing
94 changed files
with
3,259 additions
and
988 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
5 changes: 4 additions & 1 deletion
5
.changeset/two-buckets-cheer.md → .changeset/young-walls-sing.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,9 @@ | ||
--- | ||
"@hyperse/next-example": patch | ||
"@hyperse/track-docs": patch | ||
"@hyperse/track": patch | ||
--- | ||
|
||
add docs website | ||
1、fix bug | ||
2、add website | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: "PR Build and Test" | ||
on: | ||
pull_request: | ||
|
||
jobs: | ||
build-and-test: | ||
permissions: | ||
pull-requests: write | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- name: "Install Node" | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: "20.x" | ||
- name: 📥 Install Dependencies | ||
run: yarn --frozen-lockfile | ||
|
||
- name: "Build" | ||
run: yarn build | ||
|
||
- name: run coverage | ||
run: yarn test:coverage | ||
|
||
# Remove node_modules to see if this action runs entirely compiled | ||
- name: "Remove Node Modules" | ||
run: rm -rf node_modules | ||
|
||
- name: "PR Test Reports" | ||
uses: hyperse-io/[email protected] | ||
with: | ||
github-token: ${{ secrets.GITHUB_TOKEN }} | ||
include-all-projects: "false" | ||
name: "PR Test Reports" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
#!/bin/sh | ||
. "$(dirname -- "$0")/_/husky.sh" | ||
|
||
yarn run test:coverage | ||
yarn generate-coverage-report --type readme | ||
git add . | ||
yarn lint-staged-files --debug | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
## Getting Started | ||
|
||
First, run the development server: | ||
|
||
```bash | ||
npm run dev | ||
# or | ||
yarn dev | ||
# or | ||
pnpm dev | ||
# or | ||
bun run dev | ||
``` | ||
|
||
Open [http://localhost:3000](http://localhost:3000) with your browser to see the result. |
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
@tailwind base; | ||
@tailwind components; | ||
@tailwind utilities; | ||
|
||
:root { | ||
--foreground-rgb: 0, 0, 0; | ||
--background-start-rgb: 214, 219, 220; | ||
--background-end-rgb: 255, 255, 255; | ||
} | ||
|
||
@media (prefers-color-scheme: dark) { | ||
:root { | ||
--foreground-rgb: 255, 255, 255; | ||
--background-start-rgb: 0, 0, 0; | ||
--background-end-rgb: 0, 0, 0; | ||
} | ||
} | ||
|
||
body { | ||
color: rgb(var(--foreground-rgb)); | ||
background: linear-gradient( | ||
to bottom, | ||
transparent, | ||
rgb(var(--background-end-rgb)) | ||
) | ||
rgb(var(--background-start-rgb)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
import type { Metadata } from 'next'; | ||
import { Inter } from 'next/font/google'; | ||
import './globals.css'; | ||
|
||
const inter = Inter({ subsets: ['latin'] }); | ||
|
||
export const metadata: Metadata = { | ||
title: 'Create Next App', | ||
description: 'Generated by create next app', | ||
}; | ||
|
||
export default function RootLayout({ | ||
children, | ||
}: { | ||
children: React.ReactNode; | ||
}) { | ||
return ( | ||
<html lang="en"> | ||
<body className={inter.className}>{children}</body> | ||
</html> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
'use client'; | ||
|
||
import { useEffect, useState } from 'react'; | ||
import { fetchGoodsList, GoodsRecord } from './service'; | ||
|
||
export default function Home() { | ||
const [mounted, setMounted] = useState(false); | ||
|
||
useEffect(() => { | ||
setMounted(true); | ||
}, []); | ||
const onAddToCart = (item: GoodsRecord) => { | ||
console.log('onAddToCart', JSON.stringify(item)); | ||
// await reportTrack().select('reportAdapter').track('addCart', { | ||
// price: 25.99, | ||
// goodsId: '23432252', | ||
// goodsName: 'Long Chair', | ||
// count: 1, | ||
// }); | ||
}; | ||
|
||
return ( | ||
<main className="flex min-h-screen flex-col items-center justify-between gap-4"> | ||
{mounted && | ||
fetchGoodsList().map((item, index: number) => { | ||
return ( | ||
<div | ||
key={index} | ||
className="flex h-80 w-4/5 max-w-md flex-col gap-1 rounded-2xl bg-gray-50 p-3" | ||
> | ||
<div className="h-48 rounded-xl bg-gray-700"></div> | ||
<div className="flex flex-col gap-4"> | ||
<div className="flex flex-row justify-between"> | ||
<div className="flex flex-col"> | ||
<span className="text-xl font-bold text-gray-700"> | ||
{item.goodsName} | ||
</span> | ||
<p className="text-xs text-gray-700">ID: {item.goodsId}</p> | ||
</div> | ||
<span className="font-bold text-red-600">${item.price}</span> | ||
</div> | ||
<button | ||
className="rounded-md bg-sky-800 py-2 text-gray-50 hover:bg-sky-700" | ||
onClick={() => onAddToCart(item)} | ||
> | ||
Add to cart | ||
</button> | ||
</div> | ||
</div> | ||
); | ||
})} | ||
</main> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import Mock from 'mockjs'; | ||
|
||
export interface GoodsRecord { | ||
goodsName: string; | ||
goodsId: string; | ||
price: number; | ||
} | ||
|
||
export const fetchGoodsList = (): GoodsRecord[] => { | ||
const data = Mock.mock({ | ||
'list|10-20': [ | ||
{ | ||
goodsName: '@cword(3,5)', | ||
goodsId: '@id()', | ||
price: '@float(10, 100, 2, 2)', | ||
}, | ||
], | ||
}); | ||
return data.list; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { defineConfig, nextjs } from '@hyperse/eslint-config-hyperse'; | ||
|
||
export default defineConfig([ | ||
...nextjs, | ||
{ | ||
rules: { | ||
'@typescript-eslint/no-explicit-any': 'off', | ||
}, | ||
}, | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
/// <reference types="next" /> | ||
/// <reference types="next/image-types/global" /> | ||
|
||
// NOTE: This file should not be edited | ||
// see https://nextjs.org/docs/basic-features/typescript for more information. |
Oops, something went wrong.