Skip to content

Commit

Permalink
Merge branch 'main' into dms/migrate-internals
Browse files Browse the repository at this point in the history
  • Loading branch information
dschlabach committed Dec 13, 2024
2 parents 33fc5e8 + cc99956 commit c734334
Show file tree
Hide file tree
Showing 86 changed files with 792 additions and 325 deletions.
5 changes: 0 additions & 5 deletions .changeset/cold-clocks-sip.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/early-kangaroos-heal.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/funny-cheetahs-move.md

This file was deleted.

5 changes: 0 additions & 5 deletions .changeset/proud-points-judge.md

This file was deleted.

5 changes: 5 additions & 0 deletions .changeset/spotty-wasps-warn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@coinbase/onchainkit': patch
---

-**docs**: Updated `Identity` component preview. By @cpcramer #1717
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,21 @@
# Changelog

## 0.36.0

### Minor Changes

-**feat**: Improved funding flow in `Checkout` by @0xAlec #1692
-**chore**: Added `useOutsideClick` hook. By @cpcramer #1612
-**chore**: Theme styling improvements. By @brendan-defi #1676
-**fix**: Fixed `TokenDropdown` when parent container is larger than button. By @dschlabach #1667
-**chore**: Removed `Farcaster Frames`. Deprecating `Framegear`, `Frames`, `XMTP`, and `Neynar` support. By @cpcramer #1693
-**feat**: Updated `WalletModal` to support MetaMask wallet connection. By @cpcramer #1701 -**fix**: Fixed changelog generation. By @dschlabach #1680
-**docs**: Documentation updates and improvements. By @brendan-defi @0xAlec @dschlabach #1690 #1685

Breaking Changes:

- `Farcaster Frames` including `Framegear`, `Frames`, `XMTP`, and `Neynar` is no longer supported.

## 0.35.8

### Patch Changes
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "@coinbase/onchainkit",
"version": "0.35.8",
"version": "0.36.0",
"type": "module",
"repository": "https://github.com/coinbase/onchainkit.git",
"license": "MIT",
"scripts": {
"build": "packemon build --addEngines --addFiles --declaration && npx packemon validate --no-license --no-people --no-repo && tailwindcss -i ./src/styles/index.css -o ./src/tailwind.css --minify && tailwindcss -i ./src/styles/index-with-tailwind.css -o ./src/styles.css --minify",
"build": "packemon build --addEngines --addFiles --loadConfigs --declaration && npx packemon validate --no-license --no-people --no-repo && tailwindcss -i ./src/styles/index.css -o ./src/tailwind.css --minify && tailwindcss -i ./src/styles/index-with-tailwind.css -o ./src/styles.css --minify",
"check": "biome check --write .",
"check:unsafe": "biome check . --fix --unsafe",
"ci:check": "biome ci --formatter-enabled=false --linter-enabled=false",
Expand Down Expand Up @@ -63,6 +63,7 @@
"@vitest/coverage-v8": "^2.0.5",
"@vitest/ui": "^2.0.5",
"autoprefixer": "^10.4.19",
"babel-plugin-module-resolver": "^5.0.2",
"concurrently": "^8.0.0",
"graphql": "^14",
"graphql-request": "^6.1.0",
Expand Down
18 changes: 18 additions & 0 deletions packemon.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
const config = {
babelInput(config) {
config.plugins?.push([
require.resolve('babel-plugin-module-resolver'),
{
root: ['./src'],
alias: {
'@/core': './src/core',
'@/core-react': './src/core-react',
'@/ui-react': './src/ui/react',
'@': './src',
},
},
]);
},
};

export default config;
4 changes: 2 additions & 2 deletions playground/nextjs-app-router/components/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ export const AppProvider = ({ children }: { children: React.ReactNode }) => {
paymaster: paymasters?.[chainId || 8453]?.url,
wallet: {
display: 'modal',
termsUrl: 'https://www.coinbase.com/legal/cookie', // URL to the terms of service for the wallet modal
privacyUrl: 'https://www.coinbase.com/legal/privacy', // URL to the privacy policy for the wallet modal
termsUrl: 'https://www.coinbase.com/legal/cookie',
privacyUrl: 'https://www.coinbase.com/legal/privacy',
},
}}
projectId={ENVIRONMENT_VARIABLES[ENVIRONMENT.PROJECT_ID]}
Expand Down
4 changes: 2 additions & 2 deletions playground/nextjs-app-router/components/OnchainProviders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ function OnchainProviders({ children }: { children: ReactNode }) {
},
wallet: {
display: 'modal', // 'modal' || 'classic"
termsUrl: 'https://www.coinbase.com/legal/cookie', // URL to the terms of service for the wallet modal
privacyUrl: 'https://www.coinbase.com/legal/privacy', // URL to the privacy policy for the wallet modal
termsUrl: 'https://www.coinbase.com/legal/cookie',
privacyUrl: 'https://www.coinbase.com/legal/privacy',
},
}}
projectId={ENVIRONMENT_VARIABLES[ENVIRONMENT.PROJECT_ID]}
Expand Down
11 changes: 6 additions & 5 deletions playground/nextjs-app-router/onchainkit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"repository": "https://github.com/coinbase/onchainkit.git",
"license": "MIT",
"scripts": {
"build": "packemon build --addEngines --addFiles --declaration && npx packemon validate --no-license --no-people --no-repo && tailwindcss -i ./src/styles/index.css -o ./src/tailwind.css --minify && tailwindcss -i ./src/styles/index-with-tailwind.css -o ./src/styles.css --minify",
"build": "packemon build --addEngines --addFiles --loadConfigs --declaration && npx packemon validate --no-license --no-people --no-repo && tailwindcss -i ./src/styles/index.css -o ./src/tailwind.css --minify && tailwindcss -i ./src/styles/index-with-tailwind.css -o ./src/styles.css --minify",
"check": "biome check --write .",
"check:unsafe": "biome check . --fix --unsafe",
"ci:check": "biome ci --formatter-enabled=false --linter-enabled=false",
Expand Down Expand Up @@ -63,6 +63,7 @@
"@vitest/coverage-v8": "^2.0.5",
"@vitest/ui": "^2.0.5",
"autoprefixer": "^10.4.19",
"babel-plugin-module-resolver": "^5.0.2",
"concurrently": "^8.0.0",
"graphql": "^14",
"graphql-request": "^6.1.0",
Expand Down Expand Up @@ -112,10 +113,10 @@
"default": "./esm/index.js"
},
"./api": {
"types": "./esm/api/index.d.ts",
"module": "./esm/api/index.js",
"import": "./esm/api/index.js",
"default": "./esm/api/index.js"
"types": "./esm/core/api/index.d.ts",
"module": "./esm/core/api/index.js",
"import": "./esm/core/api/index.js",
"default": "./esm/core/api/index.js"
},
"./checkout": {
"types": "./esm/checkout/index.d.ts",
Expand Down
61 changes: 52 additions & 9 deletions site/docs/components/landing/ComponentPreview.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { animate } from 'motion';
import type { ReactNode } from 'react';
import { useEffect, useState } from 'react';
import { useTheme } from '../../contexts/Theme.tsx';
Expand All @@ -8,7 +9,7 @@ import { getHighlightedCode } from './getHighlightedCode.tsx';
// Demo components and code snippets
import CheckoutDemo, { checkoutDemoCode } from './CheckoutDemo.tsx';
import FundDemo, { fundDemoCode } from './FundDemo.tsx';
import IdentityDemo, { identityDemoCode } from './IdentityDemo.tsx';
import IdentityCardDemo, { identityCardDemoCode } from './IdentityCardDemo.tsx';
import NftMintCardDemo, { nftMintCardDemoCode } from './NftMintCardDemo.tsx';
import SwapDemo, { swapDemoCode } from './SwapDemo.tsx';
import TransactionDemo, { transactionDemoCode } from './TransactionDemo.tsx';
Expand Down Expand Up @@ -60,11 +61,11 @@ const components: Component[] = [
description: 'Fund wallets with a debit card or a coinbase account.',
},
{
name: 'Identity',
component: IdentityDemo,
code: identityDemoCode,
name: 'Identity Card',
component: IdentityCardDemo,
code: identityCardDemoCode,
description:
'Display the Basename, avatar, and address associated with a wallet.',
'Display the Basename, avatar, address, and social media links associated with a wallet.',
},
];

Expand All @@ -88,6 +89,10 @@ function ComponentPreview() {
});
};

const handleTabChange = (index: number) => {
setActiveTab(index);
};

if (!isClient) {
return <div>Loading...</div>;
}
Expand All @@ -97,7 +102,7 @@ function ComponentPreview() {
<div className="flex flex-col items-center gap-8 lg:flex-row lg:items-start">
<ComponentList
activeTab={activeTab}
setActiveTab={setActiveTab}
setActiveTab={handleTabChange}
components={components}
/>
<PreviewContainer
Expand All @@ -124,6 +129,24 @@ function ComponentList({
setActiveTab,
components,
}: ComponentListProps) {
const handleClick = (index: number) => {
const button = document.querySelector(`button[data-index="${index}"]`);
if (button) {
animate(
button,
{
x: [-2, 0],
opacity: [0.6, 1],
},
{
duration: 0.15,
easing: 'ease-out',
},
);
}
setActiveTab(index);
};

return (
<div className="w-full md:w-[300px] lg:flex-shrink-0">
<h3 className="pb-4 font-medium text-3xl text-zinc-900 dark:text-zinc-100">
Expand All @@ -137,12 +160,13 @@ function ComponentList({
<div key={comp.name} className="mb-4">
<button
type="button"
data-index={index}
className={`w-full px-3 py-2 text-left text-base lg:text-lg ${
activeTab === index
? 'rounded-lg bg-zinc-100 font-semibold text-indigo-600 dark:bg-[#0F0F0F] dark:text-indigo-400'
: 'text-zinc-700 hover:rounded-lg hover:bg-zinc-100 dark:text-zinc-300 dark:hover:bg-[#0F0F0F]'
}`}
onClick={() => setActiveTab(index)}
onClick={() => handleClick(index)}
>
{comp.name}
{activeTab === index && (
Expand Down Expand Up @@ -191,7 +215,7 @@ function PreviewContainer({
}, [activeTab, theme]);

return (
<div className="h-[600px] w-[375px] overflow-hidden rounded-lg border border-zinc-200 bg-zinc-50 sm:w-[600px] md:h-[670px] md:w-[700px] dark:border-zinc-900 dark:bg-[#0f0f0f]">
<div className="preview-container h-[600px] w-[375px] overflow-hidden rounded-lg border border-zinc-200 bg-zinc-50 sm:w-[600px] md:h-[670px] md:w-[700px] dark:border-zinc-900 dark:bg-[#0f0f0f]">
<div className="mt-2 flex items-center justify-between border-zinc-200 border-b px-3 dark:border-zinc-900">
<div className="flex">
<TabButton
Expand Down Expand Up @@ -245,15 +269,34 @@ function PreviewContainer({
}

function TabButton({ isActive, onClick, children }: TabButtonProps) {
const handleClick = () => {
const button = document.querySelector(`button[data-tab="${children}"]`);
if (button) {
animate(
button,
{
y: [2, 0],
opacity: [0.7, 1],
},
{
duration: 0.2,
easing: [0.22, 1.14, 0.59, 1], // Spring-like easing
},
);
}
onClick();
};

return (
<button
type="button"
data-tab={children}
className={`px-4 py-2 font-medium text-sm ${
isActive
? 'border-indigo-600 border-b-2 text-indigo-600 dark:border-indigo-400 dark:text-indigo-400'
: 'text-zinc-600 hover:text-zinc-900 dark:text-zinc-400 dark:hover:text-zinc-100'
}`}
onClick={onClick}
onClick={handleClick}
>
{children}
</button>
Expand Down
32 changes: 32 additions & 0 deletions site/docs/components/landing/IdentityCardDemo.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { IdentityCard } from '@coinbase/onchainkit/identity';
import { base } from 'viem/chains';
import App from '../App.tsx';

export const identityCardDemoCode = `
import { IdentityCard } from '@coinbase/onchainkit/identity';
import { base } from 'viem/chains';
function IdentityCardDemo() {
return (
<IdentityCard
address="0x849151d7D0bF1F34b70d5caD5149D28CC2308bf1"
chain={base}
schemaId="0xf8b05c79f090979bf4a80270aba232dff11a10d9ca55c4f88de95317970f0de9"
/>
)
}
`;

function IdentityCardDemo() {
return (
<App>
<IdentityCard
address="0x849151d7D0bF1F34b70d5caD5149D28CC2308bf1"
chain={base}
schemaId="0xf8b05c79f090979bf4a80270aba232dff11a10d9ca55c4f88de95317970f0de9"
/>
</App>
);
}

export default IdentityCardDemo;
53 changes: 0 additions & 53 deletions site/docs/components/landing/IdentityDemo.tsx

This file was deleted.

Loading

0 comments on commit c734334

Please sign in to comment.