Skip to content

Commit

Permalink
remove onboarding and taxes
Browse files Browse the repository at this point in the history
  • Loading branch information
ripgrim committed Sep 29, 2024
1 parent 467f819 commit c31824a
Show file tree
Hide file tree
Showing 9 changed files with 161 additions and 383 deletions.
9 changes: 8 additions & 1 deletion next.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,11 @@ const nextConfig = {
},
}

module.exports = nextConfig
module.exports = {
nextConfig,
compiler: {
removeConsole: {
exclude: ['error'],
},
},
}
13 changes: 13 additions & 0 deletions package-lock.json

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

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"progressive-blur": "^1.0.0",
"react": "^18",
"react-dom": "^18",
"react-error-boundary": "^4.0.13",
"react-swipeable": "^7.0.1",
"react-text-transition": "^3.1.0",
"tailwind-merge": "^2.5.2",
Expand Down
85 changes: 1 addition & 84 deletions src/app/Home.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,17 @@ import { useRouter } from 'next/navigation'
import { Button } from "@/components/ui/button"
import Link from 'next/link'
import Image from 'next/image'
// import { LinearBlur } from "progressive-blur"
import { Spotlight } from "@/components/ui/Spotlight";
import { FlipWords } from "@/components/ui/flip-words";
import { FloatingNav } from "@/components/ui/floating-navbar";
import ShinyGrid from "@/components/ui/ShinyGrid";
import TwinklingGrid from "@/components/ui/TwinklingGrid";
import { LucideHome, Info, ArrowDownToLine } from "lucide-react";

export default function Home() {
const router = useRouter()

const handleGoShopping = () => {
if (localStorage.getItem("setupSkipped")) {
router.push('/cart')
} else {
router.push('/step/1')
}
router.push('/cart')
}

const navItems = [
Expand Down Expand Up @@ -89,16 +83,6 @@ export default function Home() {
Your shopping,<br />made <FlipWords words={words} duration={2000} className='text-white' /> <br />
</h1>
<p className="text-xl text-gray-400 mb-8">Smart shopping cart calculator for savvy shoppers</p>
{/* <Button
size="lg"
className="h-12 animate-shimmer items-center justify-center
rounded-full border border-neutral-800 bg-[linear-gradient(110deg,#000000,45%,#272727,55%,#000000)]
bg-[length:200%_100%] px-6 font-medium text-white transition-colors focus:outline-none
focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-white"
onClick={handleGoShopping}
>
Start shopping smarter
</Button> */}
<Button size="lg" className="rounded-full bg-white text-black hover:bg-gray-200" onClick={handleGoShopping}>
Start shopping smarter
</Button>
Expand All @@ -107,31 +91,6 @@ export default function Home() {

<section className="container mx-auto px-4 py-10">
<div className="bg-transparent rounded-3xl px-8 relative overflow-hidden">
{/* <LinearBlur
side="bottom"
steps={32}
strength={4}
tint="rgba(0, 0, 0, 1)"
style={{
position: "absolute",
inset: 0,
height: "30%",
transform: "translateY(200%)",
pointerEvents: "none",
}}
/>
<LinearBlur
side="top"
steps={32}
strength={4}
tint="rgba(0, 0, 0, 1)"
style={{
position: "absolute",
inset: 0,
height: "30%",
pointerEvents: "none",
}}
/> */}
<Image
src="/image/landing/landing.png"
alt="EZ Cart Screenshot"
Expand Down Expand Up @@ -161,31 +120,6 @@ export default function Home() {

<section className="container mx-auto px-4 pt-10 pb-12">
<div className="bg-black rounded-3xl p-8 relative overflow-hidden">
{/* <LinearBlur
side="bottom"
steps={16}
strength={2}
tint="rgba(0, 0, 0, 1)"
style={{
position: "absolute",
inset: 0,
height: "30%",
transform: "translateY(220%)",
pointerEvents: "none",
}}
/>
<LinearBlur
side="top"
steps={32}
strength={2}
tint="rgba(0, 0, 0, 1)"
style={{
position: "absolute",
inset: 0,
height: "30%",
pointerEvents: "none",
}}
/> */}
<Image
src="/image/landing/split.png"
alt="EZ Cart Screenshot"
Expand All @@ -206,23 +140,6 @@ export default function Home() {
<p className="text-xl text-gray-400 mb-0">
Install our app for a seamless shopping experience, even without internet
</p>
{/* <div className="flex justify-center space-x-16 mt-14">
<div className="text-center">
<h3 className="text-2xl font-bold mb-4">Desktop</h3>
<ol className="text-left list-decimal list-inside">
<li>Click the install icon in the address bar</li>
<li>Select 'Install' in the prompt</li>
</ol>
</div>
<div className="text-center">
<h3 className="text-2xl font-bold mb-4">Mobile</h3>
<ol className="text-left list-decimal list-inside">
<li>Tap the share button</li>
<li>Select 'Add to Home Screen'</li>
<li>Tap 'Add' in the top right corner</li>
</ol>
</div>
</div> */}
<div className="bg-black rounded-3xl py-0 px-8 relative overflow-hidden">
<Image
src="/image/landing/install-guide.png"
Expand Down
39 changes: 21 additions & 18 deletions src/app/cart/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,24 @@ import { useCart } from '@/app/cart/src/hooks/useCart';
import { formatNumber } from '@/app/cart/src/hooks/cartUtils';
import { Plus, Share2 } from "lucide-react"
import TwinklingGrid from "@/components/ui/TwinklingGrid"
import { TaxRegion } from "@/helpers/taxes"; // Add this import
import { GroceryItem } from '@/app/cart/src/hooks/useCart'; // Add this import

interface CartCardProps {
item: GroceryItem;
taxRegion: TaxRegion | null;
formatNumber: (num: number | null | undefined) => string;
removeItem: (id: number) => void;
updateItemQuantity: (id: number, quantity: number) => void;
isItemChanged: boolean;
}

function CartContent() {
const router = useRouter()
const { toast } = useToast()
const {
items,
selectedCountry,
selectedRegion,
selectedState,
newItemName,
newItemPrice,
addItem,
Expand All @@ -36,8 +46,10 @@ function CartContent() {
clearCart,
setNewItemName,
setNewItemPrice,
setSelectedCountry,
setSelectedRegion,
setSelectedState,
taxRate,
subtotal,
taxAmount,
} = useCart();

const [backModalOpen, setBackModalOpen] = useState(false)
Expand All @@ -51,9 +63,6 @@ function CartContent() {
const [isItemChanged, setIsItemChanged] = useState(false);
const [totalChanged, setTotalChanged] = useState(false);

const subtotal = items.reduce((sum, item) => sum + item.price * item.quantity, 0);
const taxRate = selectedRegion?.taxRate || 0;
const taxAmount = subtotal * (taxRate / 100);
const total = subtotal + taxAmount;

const handleItemNameKeyDown = (e: React.KeyboardEvent<HTMLInputElement>) => {
Expand Down Expand Up @@ -101,7 +110,7 @@ function CartContent() {
if (items.length > 0) {
setBackModalOpen(true);
} else {
router.push('/onboarding');
router.push('/');
}
};

Expand All @@ -113,7 +122,7 @@ function CartContent() {

const handleConfirmBack = () => {
setBackModalOpen(false);
router.push('/onboarding');
router.push('/');
};

const handleConfirmClear = () => {
Expand Down Expand Up @@ -212,7 +221,7 @@ function CartContent() {
<CartCard
key={item.id}
item={item}
selectedCountry={selectedCountry}
taxRegion={selectedState}
formatNumber={formatNumber}
removeItem={(id) => {
removeItem(id);
Expand Down Expand Up @@ -248,18 +257,12 @@ function CartContent() {
<div className="flex flex-col py-2 mb-2 w-full">
<div className="flex justify-between items-center">
<span className="text-sm text-white">Subtotal:</span>
<span className="text-white">{formatNumber(subtotal)} {selectedCountry?.code || ''}</span>
<span className="text-white">{formatNumber(subtotal)} USD</span>
</div>
{selectedRegion && (
<div className="flex justify-between items-center mt-1">
<span className="text-sm text-white">Tax ({taxRate}%):</span>
<span className="text-white">{formatNumber(taxAmount)} {selectedCountry?.code}</span>
</div>
)}
<div className="flex justify-between items-center mt-1">
<span className="text-lg font-bold text-white">Total:</span>
<TextTransition springConfig={presets.gentle} direction={transitionDirection} inline={true} className={`text-lg font-bold ${totalChanged ? transitionColor : 'text-white'}`}>
{formatNumber(total)} {selectedCountry?.code || ''}
{formatNumber(total)} USD
</TextTransition>
</div>
<form onSubmit={handleSubmit} className="flex flex-col space-y-2 pb-4 w-full">
Expand Down
Loading

0 comments on commit c31824a

Please sign in to comment.