15 Commits

Author SHA1 Message Date
Nermin Karic
45b58d1d9a fix: use webpack and 1 worker for low-memory storefront builds 2026-11-23 01:48:00 +01:00
f97a309c21 Merge pull request 'fix: add fallback publishable keys and memory limits for storefront builds' (#8) from fix/storefront-build-env into main
Reviewed-on: #8
2026-11-23 00:37:06 +00:00
Nermin Karic
aab60fc8d4 fix: add fallback publishable keys and memory limits for storefront builds 2026-11-23 01:36:47 +01:00
ec3a4e6efc Merge pull request 'fix: set runner WORKDIR to .medusa/server for custom module resolution' (#7) from fix/dokploy-build-memory into main
Reviewed-on: #7
2026-11-23 00:14:26 +00:00
Nermin Karic
3ed45c4362 fix: set runner WORKDIR to .medusa/server for custom module resolution 2026-11-23 01:11:52 +01:00
e2279993ae Merge pull request 'design upgrade' (#6) from feat/design-upgrade into main
Reviewed-on: #6
2026-11-23 00:00:05 +00:00
Nermin Karic
ada6fd857c design upgrade 2026-11-23 00:59:47 +01:00
d3012c6f31 Merge pull request 'fix: copy compiled medusa-config.js for production runtime' (#5) from fix/dokploy-build-memory into main
Reviewed-on: #5
2026-11-22 22:14:23 +00:00
Nermin Karic
df9f8b3a7c fix: copy compiled medusa-config.js for production runtime 2026-11-22 23:13:23 +01:00
9e84140474 Merge pull request 'optimize Dockerfile: sequential build and memory limit for VPS' (#3) from fix/dokploy-build-memory into main
Reviewed-on: #3
2026-11-22 21:53:40 +00:00
Nermin Karic
45adcc2621 optimize Dockerfile: sequential build and memory limit for VPS 2026-11-22 22:51:01 +01:00
8e94f3735e Merge pull request 'add root Dockerfile for Dokploy' (#2) from feat/docker-fix-1 into main
Reviewed-on: #2
2026-11-22 21:44:36 +00:00
Nermin Karic
d0d1b5a857 add root Dockerfile for Dokploy 2026-11-22 22:41:51 +01:00
a9dc0b7e84 Merge pull request 'fix izmjena dockera' (#1) from feature/docker-fix into main
Reviewed-on: #1
2026-11-22 21:39:24 +00:00
Nermin Karic
19143514ab fix izmjena dockera 2026-11-22 22:38:10 +01:00
214 changed files with 7348 additions and 2558 deletions

11
.claude/launch.json Normal file
View File

@@ -0,0 +1,11 @@
{
"version": "0.0.1",
"configurations": [
{
"name": "suman-hrvatska",
"runtimeExecutable": "sh",
"runtimeArgs": ["-c", "cd apps/suman-hrvatska && npx next dev -p 8020"],
"port": 8020
}
]
}

31
.dockerignore Normal file
View File

@@ -0,0 +1,31 @@
# Version control
.git
.gitignore
# Dependencies
**/node_modules
npm-debug.log*
yarn-debug.log*
yarn-error.log*
# Next.js build output
**/.next/
**/out/
# Medusa build output & cache
**/.medusa/
**/.cache/
# Local environment files (do NOT bake local secrets into images)
**/.env
**/.env.local
**/.env.development.local
**/.env.test.local
**/.env.production.local
# Turbo cache
**/.turbo
# OS metadata
.DS_Store
Thumbs.db

34
.env.production.example Normal file
View File

@@ -0,0 +1,34 @@
# ========================================================
# SUMAN D.O.O. — DOCKER PRODUKCIJSKE VARIJABLE OKRUŽENJA
# ========================================================
# Kopirajte ovaj fajl u .env.production ili .env na serveru:
# cp .env.production.example .env
# --- POSTGRESQL BAZA ---
POSTGRES_USER=suman_prod_user
POSTGRES_PASSWORD=PostaviSigurnuLozinkuBaze123!
POSTGRES_DB=suman_prod_db
# --- REDIS CACHE ---
REDIS_PASSWORD=PostaviSigurnuLozinkuRedis123!
# --- MEDUSA V2 BACKEND ---
BACKEND_PORT=9000
JWT_SECRET=generisi_siguran_jwt_secret_najmanje_32_karaktera
COOKIE_SECRET=generisi_siguran_cookie_secret_najmanje_32_karaktera
MEDUSA_BACKEND_URL=https://api.suman.ba
# CORS Konfiguracija (odvojeno zarezima)
STORE_CORS=https://suman.ba,https://suman.hr,http://localhost:8000,http://localhost:8002
ADMIN_CORS=https://admin.suman.ba,http://localhost:9000
AUTH_CORS=https://admin.suman.ba,https://suman.ba,https://suman.hr,http://localhost:9000,http://localhost:8000,http://localhost:8002
# --- STOREFRONT BOSNA I HERCEGOVINA ---
STOREFRONT_BA_PORT=8000
STOREFRONT_BA_BASE_URL=https://suman.ba
MEDUSA_PUBLISHABLE_KEY_BA=pk_b722e44870bc8cc7828d0713980537e95b2e74ff229a529a4b3fa8155035f1f0
# --- STOREFRONT HRVATSKA ---
STOREFRONT_HR_PORT=8002
STOREFRONT_HR_BASE_URL=https://suman.hr
MEDUSA_PUBLISHABLE_KEY_HR=pk_suman_hrvatska_publishable_key

63
Dockerfile Normal file
View File

@@ -0,0 +1,63 @@
# ==========================================
# Root Dockerfile for Dokploy & Monorepo Deployments
# Defaults to building the Medusa v2 Backend
# ==========================================
# 1. Base stage with dependencies
FROM node:22-alpine AS base
WORKDIR /app
RUN apk add --no-cache libc6-compat curl
# Copy root workspace manifests
COPY package.json package-lock.json ./
COPY apps/backend/package.json ./apps/backend/
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
# Install dependencies for backend workspace
RUN npm ci --workspace=@dtc/backend --include-workspace-root
# 2. Build stage
FROM base AS builder
WORKDIR /app
COPY apps/backend ./apps/backend
ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-old-space-size=2048"
# Build Medusa backend and admin dashboard (compiled to .medusa/server)
RUN npm run build --workspace=@dtc/backend
# Prune devDependencies to keep image light and avoid OOM during copy
RUN npm prune --production --workspace=@dtc/backend
# 3. Production runner stage
# In Medusa v2, production runtime runs from the compiled .medusa/server directory
FROM node:22-alpine AS runner
WORKDIR /app/apps/backend/.medusa/server
RUN apk add --no-cache libc6-compat curl
ENV NODE_ENV=production
ENV PORT=9000
# Non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 medusa
# Copy dependencies and compiled server artifacts
COPY --from=builder --chown=medusa:nodejs /app/node_modules /app/node_modules
COPY --from=builder --chown=medusa:nodejs /app/package.json /app/package-lock.json /app/
COPY --from=builder --chown=medusa:nodejs /app/apps/backend /app/apps/backend
# Uploads directory
RUN mkdir -p /app/apps/backend/.medusa/server/uploads /app/apps/backend/uploads && \
chown -R medusa:nodejs /app/apps/backend
USER medusa
EXPOSE 9000
# Medusa v2 production entrypoint: run migrations then start server from compiled .medusa/server
CMD ["sh", "-c", "npx medusa db:migrate && npm run start"]

62
apps/backend/Dockerfile Normal file
View File

@@ -0,0 +1,62 @@
# ==========================================
# Medusa v2 Production Dockerfile
# ==========================================
# 1. Base stage with dependencies
FROM node:22-alpine AS base
WORKDIR /app
RUN apk add --no-cache libc6-compat curl
# Copy root workspace manifests
COPY package.json package-lock.json ./
COPY apps/backend/package.json ./apps/backend/
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
# Install dependencies for backend workspace
RUN npm ci --workspace=@dtc/backend --include-workspace-root
# 2. Build stage
FROM base AS builder
WORKDIR /app
COPY apps/backend ./apps/backend
ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-old-space-size=2048"
# Build Medusa backend and admin dashboard (compiled to .medusa/server)
RUN npm run build --workspace=@dtc/backend
# Prune devDependencies to keep image light and avoid OOM during copy
RUN npm prune --production --workspace=@dtc/backend
# 3. Production runner stage
# In Medusa v2, production runtime runs from the compiled .medusa/server directory
FROM node:22-alpine AS runner
WORKDIR /app/apps/backend/.medusa/server
RUN apk add --no-cache libc6-compat curl
ENV NODE_ENV=production
ENV PORT=9000
# Non-root user
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 medusa
# Copy dependencies and compiled server artifacts
COPY --from=builder --chown=medusa:nodejs /app/node_modules /app/node_modules
COPY --from=builder --chown=medusa:nodejs /app/package.json /app/package-lock.json /app/
COPY --from=builder --chown=medusa:nodejs /app/apps/backend /app/apps/backend
# Uploads directory
RUN mkdir -p /app/apps/backend/.medusa/server/uploads /app/apps/backend/uploads && \
chown -R medusa:nodejs /app/apps/backend
USER medusa
EXPOSE 9000
# Medusa v2 production entrypoint: run migrations then start server from compiled .medusa/server
CMD ["sh", "-c", "npx medusa db:migrate && npm run start"]

View File

@@ -0,0 +1,22 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const utils_1 = require("@medusajs/framework/utils");
(0, utils_1.loadEnv)(process.env.NODE_ENV || 'development', process.cwd());
module.exports = (0, utils_1.defineConfig)({
projectConfig: {
databaseUrl: process.env.DATABASE_URL,
http: {
storeCors: process.env.STORE_CORS,
adminCors: process.env.ADMIN_CORS,
authCors: process.env.AUTH_CORS,
jwtSecret: process.env.JWT_SECRET,
cookieSecret: process.env.COOKIE_SECRET,
}
},
modules: [
{
resolve: "./src/modules/inquiry",
},
],
});
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWVkdXNhLWNvbmZpZy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL21lZHVzYS1jb25maWcudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7QUFBQSxxREFBaUU7QUFFakUsSUFBQSxlQUFPLEVBQUMsT0FBTyxDQUFDLEdBQUcsQ0FBQyxRQUFRLElBQUksYUFBYSxFQUFFLE9BQU8sQ0FBQyxHQUFHLEVBQUUsQ0FBQyxDQUFBO0FBRTdELE1BQU0sQ0FBQyxPQUFPLEdBQUcsSUFBQSxvQkFBWSxFQUFDO0lBQzVCLGFBQWEsRUFBRTtRQUNiLFdBQVcsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFlBQVk7UUFDckMsSUFBSSxFQUFFO1lBQ0osU0FBUyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBVztZQUNsQyxTQUFTLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxVQUFXO1lBQ2xDLFFBQVEsRUFBRSxPQUFPLENBQUMsR0FBRyxDQUFDLFNBQVU7WUFDaEMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsVUFBVTtZQUNqQyxZQUFZLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxhQUFhO1NBQ3hDO0tBQ0Y7SUFDRCxPQUFPLEVBQUU7UUFDUDtZQUNFLE9BQU8sRUFBRSx1QkFBdUI7U0FDakM7S0FDRjtDQUNGLENBQUMsQ0FBQSJ9

View File

@@ -32,5 +32,6 @@
".medusa/admin", ".medusa/admin",
".cache", ".cache",
"eslint.config.*", "eslint.config.*",
"src/scripts"
] ]
} }

View File

@@ -0,0 +1,57 @@
# ==========================================
# Next.js 16 Storefront Production Dockerfile (Suman Bosna)
# ==========================================
# 1. Base stage with dependencies
FROM node:22-alpine AS base
WORKDIR /app
RUN apk add --no-cache libc6-compat
COPY package.json package-lock.json ./
COPY apps/backend/package.json ./apps/backend/
COPY apps/suman-bosna/package.json ./apps/suman-bosna/
COPY apps/suman-hrvatska/package.json ./apps/suman-hrvatska/
RUN npm ci --workspace=@dtc/suman-bosna --include-workspace-root
# 2. Build stage
FROM base AS builder
WORKDIR /app
COPY apps/suman-bosna ./apps/suman-bosna
ARG NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://backend:9000
ARG NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=pk_b722e44870bc8cc7828d0713980537e95b2e74ff229a529a4b3fa8155035f1f0
ARG NEXT_PUBLIC_BASE_URL=http://localhost:8000
ARG NEXT_PUBLIC_DEFAULT_REGION=ba
ENV NEXT_PUBLIC_MEDUSA_BACKEND_URL=$NEXT_PUBLIC_MEDUSA_BACKEND_URL
ENV NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY=$NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY
ENV NEXT_PUBLIC_BASE_URL=$NEXT_PUBLIC_BASE_URL
ENV NEXT_PUBLIC_DEFAULT_REGION=$NEXT_PUBLIC_DEFAULT_REGION
ENV NODE_ENV=production
ENV NODE_OPTIONS="--max-old-space-size=1024"
RUN npm run build --workspace=@dtc/suman-bosna
# 3. Production runner stage
FROM node:22-alpine AS runner
WORKDIR /app/apps/suman-bosna
RUN apk add --no-cache libc6-compat curl
ENV NODE_ENV=production
ENV PORT=8000
RUN addgroup --system --gid 1001 nodejs && \
adduser --system --uid 1001 nextjs
COPY --from=base --chown=nextjs:nodejs /app/node_modules /app/node_modules
COPY --from=base --chown=nextjs:nodejs /app/package.json /app/package-lock.json /app/
COPY --from=builder --chown=nextjs:nodejs /app/apps/suman-bosna /app/apps/suman-bosna
USER nextjs
EXPOSE 8000
CMD ["npm", "run", "start"]

View File

@@ -10,6 +10,10 @@ const requiredEnvs = [
]; ];
function checkEnvVariables() { function checkEnvVariables() {
if (!process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY) {
process.env.NEXT_PUBLIC_MEDUSA_PUBLISHABLE_KEY = "pk_b722e44870bc8cc7828d0713980537e95b2e74ff229a529a4b3fa8155035f1f0";
}
const missingEnvs = requiredEnvs.filter(function (env) { const missingEnvs = requiredEnvs.filter(function (env) {
c; c;
return !process.env[env.key]; return !process.env[env.key];

View File

@@ -1,7 +1,7 @@
/// <reference types="next" /> /// <reference types="next" />
/// <reference types="next/image-types/global" /> /// <reference types="next/image-types/global" />
import "./.next/dev/types/routes.d.ts"; import "./.next/types/routes.d.ts";
import "./.next/dev/types/root-params.d.ts"; import "./.next/types/root-params.d.ts";
// NOTE: This file should not be edited // NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information. // see https://nextjs.org/docs/app/api-reference/config/typescript for more information.

View File

@@ -13,6 +13,9 @@ const S3_PATHNAME = process.env.MEDUSA_CLOUD_S3_PATHNAME
*/ */
const nextConfig = { const nextConfig = {
reactStrictMode: true, reactStrictMode: true,
experimental: {
cpus: 1,
},
async headers() { async headers() {
return [ return [
{ {

View File

@@ -9,7 +9,7 @@
], ],
"scripts": { "scripts": {
"dev": "next dev -p 8000", "dev": "next dev -p 8000",
"build": "next build", "build": "next build --webpack",
"start": "next start -p 8000", "start": "next start -p 8000",
"lint": "eslint .", "lint": "eslint .",
"analyze": "ANALYZE=true next build" "analyze": "ANALYZE=true next build"

Binary file not shown.

After

Width:  |  Height:  |  Size: 292 KiB

View File

@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Generator: Adobe Illustrator 22.0.1, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
viewBox="0 0 97 100" style="enable-background:new 0 0 97 100;" xml:space="preserve">
<style type="text/css">
.st0{fill-rule:evenodd;clip-rule:evenodd;fill:#002655;}
.st1{fill-rule:evenodd;clip-rule:evenodd;fill:#F9D81C;}
.st2{fill:#F9D81C;}
</style>
<rect class="st0" width="97.2" height="97.2"/>
<rect y="97.2" class="st1" width="97.2" height="2.8"/>
<path class="st2" d="M67.6,82v-2.2l-0.3,0.1c-0.7,0.1-1.3,0.3-1.7,0.4c-0.5,0.2-0.8,0.3-1.1,0.5l0,0c-0.2,0.2-0.3,0.4-0.4,0.6
c-0.1,0.2-0.1,0.5-0.1,0.7c0,0.5,0.1,0.8,0.4,1l0,0c0.2,0.1,0.3,0.2,0.5,0.3c0.2,0.1,0.4,0.1,0.7,0.1c0.2,0,0.4,0,0.6-0.1
c0.2-0.1,0.4-0.2,0.6-0.3l0,0c0.2-0.1,0.3-0.2,0.4-0.4l0,0c0.1-0.1,0.2-0.3,0.3-0.4v0L67.6,82z M83.9,85.6h-4.4h-0.2v-0.2v-0.8v-0.2
l0.2,0c0.3,0,0.5-0.1,0.5-0.4h0c0-0.1,0-0.2,0-0.2c0,0,0-0.1,0-0.1v-5.2c0-0.3,0-0.6-0.1-0.8c-0.1-0.2-0.1-0.4-0.3-0.6l0,0
c-0.1-0.2-0.3-0.3-0.5-0.4v0c-1-0.4-1.9,0-2.6,0.7l-0.3,0.4v5.9v0.2c0,0.1,0,0.2,0,0.3v0c0,0.2,0.3,0.2,0.4,0.2l0,0l0,0l0.2,0l0.2,0
v0.2v0.8v0.2h-0.2h-4.3h-0.2v-0.2v-0.8v-0.2l0.2,0c0.2,0,0.5,0,0.5-0.3c0-0.1,0-0.2,0-0.3v-0.2v-6.8c0-0.2,0-0.4,0-0.5
c0-0.4-0.1-0.6-0.5-0.7l-0.2,0v-0.2v-0.8v-0.2h0.2h3.3h0.2v0.2v0.5c0.1-0.1,0.1-0.1,0.2-0.2c0.3-0.2,0.6-0.3,1-0.5l0,0
c0.4-0.2,0.8-0.3,1.1-0.4c0.4-0.1,0.8-0.1,1.2-0.1c0.6,0,1.1,0.1,1.6,0.3c0.5,0.2,0.9,0.5,1.2,0.9l0,0c0.3,0.4,0.5,0.8,0.7,1.4
c0.1,0.5,0.2,1.1,0.2,1.8v5.2c0,0.2,0,0.3,0,0.4v0c0,0.3,0.2,0.3,0.4,0.3l0,0l0.2,0l0.2,0v0.2v0.8v0.2H83.9z M59.1,85.6h-4.2h-0.2
v-0.2v-0.8v-0.2l0.2,0c0.2,0,0.4-0.1,0.4-0.3c0,0,0-0.1,0-0.2c0-0.1,0-0.3,0-0.4v-5.1c0-0.3,0-0.6-0.1-0.8c-0.1-0.2-0.2-0.4-0.4-0.5
c-0.1-0.1-0.3-0.2-0.5-0.3c-1.3-0.4-2,0.2-2.7,1.1v5.9c0,0.1,0,0.2,0,0.2c0,0.3,0.1,0.5,0.4,0.5l0,0l0.2,0l0.2,0v0.2v0.8v0.2h-0.2
h-4.3h-0.2v-0.2v-0.8v-0.2l0.2,0c0.3-0.1,0.5,0,0.5-0.5l0,0c0,0,0-0.1,0-0.2c0-0.1,0-0.1,0-0.1l0,0v-5.2c0-0.3,0-0.6-0.1-0.8
c-0.1-0.2-0.2-0.4-0.3-0.6l0,0c-0.1-0.2-0.3-0.3-0.5-0.4c-1.2-0.5-2.2,0.2-2.8,1.2v5.8v0.3c0,0.5,0.2,0.4,0.6,0.4l0.2,0v0.2v0.8v0.2
h-0.2h-4.2h-0.2v-0.2v-0.8v-0.2l0.2,0c0.4-0.1,0.5,0,0.5-0.4v-0.3v-7c0-0.1,0-0.3,0-0.4v0c0-0.2,0-0.2-0.1-0.3
c-0.2-0.1-0.4-0.2-0.7-0.1v-0.3v-0.8v-0.2h0.2h3.5h0.2v0.2v0.6c0.1-0.1,0.2-0.1,0.2-0.2c0.2-0.2,0.5-0.3,0.8-0.5l0,0
c0.4-0.2,0.7-0.3,1.1-0.4c0.4-0.1,0.7-0.1,1.1-0.1c0.7,0,1.3,0.1,1.8,0.4c0.3,0.1,0.5,0.3,0.8,0.5c0.2,0.2,0.4,0.3,0.5,0.5
c0.1-0.1,0.3-0.3,0.5-0.4c0.3-0.2,0.6-0.4,0.9-0.5l0,0c0.4-0.2,0.8-0.3,1.2-0.4c0.4-0.1,0.8-0.1,1.2-0.1c0.6,0,1.2,0.1,1.7,0.3
c0.5,0.2,0.9,0.5,1.2,0.8h0c0.3,0.3,0.5,0.8,0.7,1.3c0.1,0.5,0.2,1.1,0.2,1.7v5.2v0.4c0,0.1,0,0.2,0,0.3v0c0,0.2,0.3,0.2,0.5,0.2
l0,0l0.2,0l0.2,0v0.2v0.8v0.2H59.1z M39.6,85.6h-3.5h-0.2v-0.2v-0.7c-0.3,0.2-0.6,0.4-0.8,0.5c-0.3,0.2-0.5,0.3-0.8,0.4
c-0.3,0.1-0.5,0.2-0.8,0.2c-0.3,0.1-0.6,0.1-0.9,0.1c-0.6,0-1.2-0.1-1.7-0.3c-0.5-0.2-0.9-0.5-1.3-0.8l0,0c-0.3-0.3-0.6-0.7-0.8-1.2
c-0.2-0.4-0.3-0.9-0.3-1.4v-5.9h0c0-0.4,0-0.7-0.5-0.6l-0.3,0v-0.3v-0.8v-0.2h0.2h3.6h0.2v0.2v7.2c0,0.3,0,0.5,0.1,0.7
c0.1,0.2,0.2,0.4,0.3,0.5c0.1,0.2,0.3,0.3,0.5,0.4c0.2,0.1,0.5,0.1,0.8,0.1c0.5,0,1-0.2,1.5-0.5h0c0.3-0.2,0.5-0.4,0.6-0.6
c0.1-0.2,0.2-0.4,0.2-0.7v-5.3c0-0.1,0-0.2,0-0.2c0-0.4-0.3-0.5-0.6-0.4l-0.3,0v-0.3v-0.8v-0.2H35h3.8H39v0.2v8.9c0,0.1,0,0.2,0,0.2
c0,0.5,0.2,0.5,0.6,0.5l0.2,0v0.2v0.8v0.2H39.6z M26.9,80.7c0,0.8-0.2,1.5-0.5,2.1c-0.3,0.6-0.8,1.2-1.5,1.7
c-0.6,0.5-1.4,0.8-2.2,1.1c-0.9,0.2-1.8,0.4-2.9,0.4c-0.7,0-1.3-0.1-1.9-0.2c-0.6-0.1-1.2-0.4-1.7-0.7c-0.6-0.3-1.1-0.7-1.6-1.2
c-0.5-0.5-0.9-1-1.2-1.6l0,0l-0.3-0.5l-0.1-0.2l0.2-0.1l3.1-2.2l0.2-0.1l0.1,0.2l0.7,0.7l0.1,0.2l-0.1,0.2l-0.2,0.3l0,0
c-0.1,0.1-0.1,0.2-0.2,0.3v0c0,0.1-0.1,0.2-0.1,0.3c0,0.5,0.3,1,0.8,1.3h0c0.3,0.2,0.7,0.4,1.1,0.5c0.4,0.1,0.9,0.2,1.3,0.2
c0.5,0,0.9,0,1.2-0.1c0.4-0.1,0.7-0.2,0.9-0.4l0,0c0.3-0.2,0.6-0.5,0.8-0.8c0.2-0.3,0.3-0.7,0.3-1.1c0-0.3-0.1-0.6-0.3-0.9
c-0.2-0.3-0.5-0.5-0.9-0.7l0,0c-0.1-0.1-0.4-0.2-0.9-0.3c-0.4-0.1-1-0.3-1.7-0.4l0,0l-1-0.3c-0.7-0.2-1.4-0.4-1.9-0.6
c-0.5-0.2-1-0.4-1.3-0.7v0c-0.5-0.4-0.9-0.8-1.1-1.3c-0.2-0.5-0.4-1.1-0.4-1.8c0-0.7,0.2-1.4,0.5-2c0.3-0.6,0.8-1.1,1.4-1.5l0,0
c0.6-0.4,1.2-0.7,2-0.9c0.7-0.2,1.6-0.3,2.5-0.3c0.6,0,1.2,0.1,1.8,0.2c0.6,0.1,1.1,0.3,1.6,0.5c0.5,0.2,1,0.5,1.4,0.8
c0.4,0.3,0.9,0.8,1.2,1.2l0.2,0.3l0.1,0.2l-0.2,0.2l-2.5,2.2L23.8,75l-0.2-0.1l-0.7-0.6l-0.1-0.1l0.1-0.2l0.1-0.4l0,0
c0,0,0-0.1,0-0.1h0c0,0,0,0,0-0.1c0,0,0,0,0-0.1c0-0.2-0.1-0.4-0.2-0.5c-0.2-0.2-0.4-0.4-0.7-0.5c-0.3-0.2-0.7-0.3-1-0.4
c-0.3-0.1-0.7-0.1-1-0.1c-0.4,0-0.8,0-1.1,0.1c-0.3,0.1-0.6,0.1-0.8,0.2v0c-0.3,0.1-0.5,0.3-0.7,0.5c-0.1,0.2-0.2,0.5-0.2,0.7
c0,0.3,0.1,0.6,0.2,0.8c0.2,0.2,0.4,0.4,0.8,0.6v0c0.1,0.1,0.4,0.1,0.8,0.2c0.4,0.1,0.9,0.2,1.5,0.4l0,0l1.2,0.3l0,0
c0.8,0.2,1.4,0.4,2,0.6c0.6,0.3,1.1,0.6,1.5,0.9c0.5,0.4,0.9,1,1.2,1.5C26.8,79.3,26.9,80,26.9,80.7z M71.3,85.6H68h-0.2v-0.2v-0.5
c-0.4,0.3-0.9,0.6-1.4,0.8c-0.6,0.2-1.2,0.3-1.9,0.3c-0.6,0-1.1-0.1-1.6-0.2c-0.5-0.2-0.9-0.4-1.3-0.7h0c-0.4-0.3-0.7-0.8-0.9-1.2
c-0.2-0.5-0.3-1-0.3-1.5c0-0.5,0.1-0.9,0.3-1.3c0.2-0.4,0.4-0.8,0.8-1.1c0.3-0.3,0.7-0.5,1.1-0.7c0.4-0.2,0.9-0.4,1.4-0.6l0,0
c0.4-0.1,0.8-0.2,1.4-0.3c0.5-0.1,1.1-0.2,1.7-0.3h0l0.5-0.1v-0.1c0-0.2,0-0.4-0.1-0.5c-0.1-0.2-0.3-0.3-0.5-0.4
c-0.2-0.1-0.5-0.2-0.8-0.3c-0.3-0.1-0.7-0.1-1.2-0.1c-0.2,0-0.4,0-0.6,0.1c-0.2,0-0.4,0.1-0.6,0.2l0,0c-0.2,0.1-0.4,0.2-0.5,0.3
c-0.2,0.1-0.3,0.3-0.4,0.4l-0.2,0.2l-0.1,0.1h-0.1h-1h-0.2v-0.2V75v-0.2l0.2-0.1l0.4-0.1l0,0c0.3-0.1,0.7-0.2,1.1-0.3
c0.4-0.1,0.7-0.1,1.1-0.2c0.4-0.1,0.7-0.1,1-0.1c0.3,0,0.6,0,0.9,0c1.6,0,2.8,0.3,3.7,1c0.8,0.7,1.3,1.6,1.3,3v6
c0,0.3,0.2,0.5,0.5,0.4l0.3-0.1v0.3v0.8v0.2H71.3z"/>
</svg>

After

Width:  |  Height:  |  Size: 5.7 KiB

View File

@@ -7,7 +7,7 @@ import { Metadata } from "next"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Checkout", title: "Plaćanje",
} }
export default async function Checkout() { export default async function Checkout() {
@@ -20,7 +20,7 @@ export default async function Checkout() {
const customer = await retrieveCustomer() const customer = await retrieveCustomer()
return ( return (
<div className="grid grid-cols-1 small:grid-cols-[1fr_416px] content-container gap-x-40 py-12"> <div className="content-container grid grid-cols-1 gap-x-16 xl:gap-x-24 py-10 sm:py-14 lg:grid-cols-[1fr_420px]">
<PaymentWrapper cart={cart}> <PaymentWrapper cart={cart}>
<CheckoutForm cart={cart} customer={customer} /> <CheckoutForm cart={cart} customer={customer} />
</PaymentWrapper> </PaymentWrapper>

View File

@@ -1,42 +1,44 @@
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import ChevronDown from "@modules/common/icons/chevron-down" import { Logo } from "@/components/ui/logo"
import MedusaCTA from "@modules/layout/components/medusa-cta" import { ArrowLeft, Lock } from "lucide-react"
/** Focused checkout shell: back to cart, logo, secure-payment note */
export default function CheckoutLayout({ export default function CheckoutLayout({
children, children,
}: { }: {
children: React.ReactNode children: React.ReactNode
}) { }) {
return ( return (
<div className="w-full bg-white relative small:min-h-screen"> <div className="relative w-full bg-background lg:min-h-screen">
<div className="h-16 bg-white border-b "> <div className="sticky top-0 z-50 border-b border-border/70 bg-background">
<nav className="flex h-full items-center content-container justify-between"> <nav className="content-container grid h-14 grid-cols-[1fr_auto_1fr] items-center sm:h-16">
<LocalizedClientLink <LocalizedClientLink
href="/cart" href="/cart"
className="text-small-semi text-ui-fg-base flex items-center gap-x-2 uppercase flex-1 basis-0" className="flex items-center gap-2 justify-self-start text-sm text-muted-foreground transition-colors hover:text-foreground"
data-testid="back-to-cart-link" data-testid="back-to-cart-link"
> >
<ChevronDown className="rotate-90" size={16} /> <ArrowLeft className="h-4 w-4" />
<span className="mt-px hidden small:block txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base "> <span className="hidden sm:inline">Nazad u korpu</span>
Back to shopping cart <span className="sm:hidden">Nazad</span>
</span>
<span className="mt-px block small:hidden txt-compact-plus text-ui-fg-subtle hover:text-ui-fg-base">
Back
</span>
</LocalizedClientLink> </LocalizedClientLink>
<LocalizedClientLink <LocalizedClientLink
href="/" href="/"
className="txt-compact-xlarge-plus text-ui-fg-subtle hover:text-ui-fg-base uppercase" className="relative w-[56px] self-stretch sm:w-[72px]"
data-testid="store-link" data-testid="store-link"
aria-label="Suman d.o.o. početna"
> >
Medusa Store <span className="absolute inset-x-0 top-0 block">
<Logo priority alt="" />
</span>
</LocalizedClientLink> </LocalizedClientLink>
<div className="flex-1 basis-0" /> <p className="flex items-center gap-1.5 justify-self-end text-xs text-muted-foreground">
<Lock className="h-3.5 w-3.5" />
<span className="hidden sm:inline">Sigurno plaćanje</span>
</p>
</nav> </nav>
</div> </div>
<div className="relative" data-testid="checkout-container">{children}</div> <div className="relative" data-testid="checkout-container">
<div className="py-4 w-full flex items-center justify-center"> {children}
<MedusaCTA />
</div> </div>
</div> </div>
) )

View File

@@ -3,14 +3,14 @@ import { Metadata } from "next"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "404", title: "404",
description: "Something went wrong", description: "Stranica nije pronađena.",
} }
export default async function NotFound() { export default async function NotFound() {
return ( return (
<div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]"> <div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1> <h1 className="font-display text-2xl text-foreground">Page not found</h1>
<p className="text-small-regular text-ui-fg-base"> <p className="text-sm text-foreground">
The page you tried to access does not exist. The page you tried to access does not exist.
</p> </p>
<InteractiveLink href="/">Go to frontpage</InteractiveLink> <InteractiveLink href="/">Go to frontpage</InteractiveLink>

View File

@@ -1,3 +1,4 @@
import SectionHeading from "@modules/account/components/section-heading"
import { Metadata } from "next" import { Metadata } from "next"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
@@ -8,7 +9,7 @@ import { retrieveCustomer } from "@lib/data/customer"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Addresses", title: "Addresses",
description: "View your addresses", description: "Pregled vaših adresa.",
} }
export default async function Addresses(props: { export default async function Addresses(props: {
@@ -25,13 +26,10 @@ export default async function Addresses(props: {
return ( return (
<div className="w-full" data-testid="addresses-page-wrapper"> <div className="w-full" data-testid="addresses-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4"> <SectionHeading
<h1 className="text-2xl-semi">Shipping Addresses</h1> title="Adrese za dostavu"
<p className="text-base-regular"> description="Sačuvane adrese nude se automatski pri plaćanju, pa naručujete brže."
View and update your shipping addresses, you can add as many as you />
like. Saving your addresses will make them available during checkout.
</p>
</div>
<AddressBook customer={customer} region={region} /> <AddressBook customer={customer} region={region} />
</div> </div>
) )

View File

@@ -2,7 +2,7 @@ import Spinner from "@modules/common/icons/spinner"
export default function Loading() { export default function Loading() {
return ( return (
<div className="flex items-center justify-center w-full h-full text-ui-fg-base"> <div className="flex items-center justify-center w-full h-full text-foreground">
<Spinner size={36} /> <Spinner size={36} />
</div> </div>
) )

View File

@@ -1,14 +1,14 @@
import SectionHeading from "@modules/account/components/section-heading"
import { Metadata } from "next" import { Metadata } from "next"
import OrderOverview from "@modules/account/components/order-overview" import OrderOverview from "@modules/account/components/order-overview"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import { listOrders } from "@lib/data/orders" import { listOrders } from "@lib/data/orders"
import Divider from "@modules/common/components/divider"
import TransferRequestForm from "@modules/account/components/transfer-request-form" import TransferRequestForm from "@modules/account/components/transfer-request-form"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Orders", title: "Narudžbe",
description: "Overview of your previous orders.", description: "Pregled vaših prethodnih narudžbi.",
} }
export default async function Orders() { export default async function Orders() {
@@ -20,16 +20,12 @@ export default async function Orders() {
return ( return (
<div className="w-full" data-testid="orders-page-wrapper"> <div className="w-full" data-testid="orders-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4"> <SectionHeading
<h1 className="text-2xl-semi">Orders</h1> title="Narudžbe"
<p className="text-base-regular"> description="Pregled vaših narudžbi, statusa i isporuka."
View your previous orders and their status. You can also create />
returns or exchanges for your orders if needed. <OrderOverview orders={orders} />
</p> <div className="mt-14 rounded-2xl bg-muted p-6 sm:p-8">
</div>
<div>
<OrderOverview orders={orders} />
<Divider className="mb-8 mt-8" />
<TransferRequestForm /> <TransferRequestForm />
</div> </div>
</div> </div>

View File

@@ -6,8 +6,8 @@ import { retrieveCustomer } from "@lib/data/customer"
import { listOrders } from "@lib/data/orders" import { listOrders } from "@lib/data/orders"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Account", title: "Moj račun",
description: "Overview of your account activity.", description: "Pregled aktivnosti na vašem računu.",
} }
export default async function OverviewTemplate() { export default async function OverviewTemplate() {

View File

@@ -1,3 +1,4 @@
import SectionHeading from "@modules/account/components/section-heading"
import { Metadata } from "next" import { Metadata } from "next"
import ProfilePhone from "@modules/account//components/profile-phone" import ProfilePhone from "@modules/account//components/profile-phone"
@@ -10,7 +11,7 @@ import { retrieveCustomer } from "@lib/data/customer"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Profile", title: "Profile",
description: "View and edit your Medusa Store profile.", description: "Pregled i izmjena vašeg profila.",
} }
export default async function Profile() { export default async function Profile() {
@@ -23,29 +24,19 @@ export default async function Profile() {
return ( return (
<div className="w-full" data-testid="profile-page-wrapper"> <div className="w-full" data-testid="profile-page-wrapper">
<div className="mb-8 flex flex-col gap-y-4"> <SectionHeading
<h1 className="text-2xl-semi">Profile</h1> title="Profil"
<p className="text-base-regular"> description="Ime, email, telefon i adresa za račun koje koristimo za vaše narudžbe."
View and update your profile information, including your name, email, />
and phone number. You can also update your billing address, or change <div className="flex w-full flex-col divide-y divide-border/70 border-y border-border/70">
your password.
</p>
</div>
<div className="flex flex-col gap-y-8 w-full">
<ProfileName customer={customer} /> <ProfileName customer={customer} />
<Divider />
<ProfileEmail customer={customer} /> <ProfileEmail customer={customer} />
<Divider />
<ProfilePhone customer={customer} /> <ProfilePhone customer={customer} />
<Divider /> {/* <ProfilePassword customer={customer} /> */}
{/* <ProfilePassword customer={customer} />
<Divider /> */}
<ProfileBillingAddress customer={customer} regions={regions} /> <ProfileBillingAddress customer={customer} regions={regions} />
</div> </div>
</div> </div>
) )
} }
const Divider = () => {
return <div className="w-full h-px bg-gray-200" />
}

View File

@@ -3,8 +3,8 @@ import { Metadata } from "next"
import LoginTemplate from "@modules/account/templates/login-template" import LoginTemplate from "@modules/account/templates/login-template"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Sign in", title: "Prijava",
description: "Sign in to your Medusa Store account.", description: "Prijavite se na svoj Suman račun.",
} }
export default function Login() { export default function Login() {

View File

@@ -2,7 +2,7 @@ import Spinner from "@modules/common/icons/spinner"
export default function Loading() { export default function Loading() {
return ( return (
<div className="flex items-center justify-center w-full h-full text-ui-fg-base"> <div className="flex items-center justify-center w-full h-full text-foreground">
<Spinner size={36} /> <Spinner size={36} />
</div> </div>
) )

View File

@@ -4,14 +4,14 @@ import InteractiveLink from "@modules/common/components/interactive-link"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "404", title: "404",
description: "Something went wrong", description: "Nešto nije u redu.",
} }
export default function NotFound() { export default function NotFound() {
return ( return (
<div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]"> <div className="flex flex-col items-center justify-center min-h-[calc(100vh-64px)]">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1> <h1 className="font-display text-2xl text-foreground">Page not found</h1>
<p className="text-small-regular text-ui-fg-base"> <p className="text-sm text-foreground">
The cart you tried to access does not exist. Clear your cookies and try The cart you tried to access does not exist. Clear your cookies and try
again. again.
</p> </p>

View File

@@ -5,8 +5,8 @@ import { Metadata } from "next"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Cart", title: "Korpa",
description: "View your cart", description: "Pregled vaše korpe.",
} }
export default async function Cart() { export default async function Cart() {

View File

@@ -22,12 +22,12 @@ export async function generateMetadata(props: Props): Promise<Metadata> {
try { try {
const productCategory = await getCategoryByHandle(params.category) const productCategory = await getCategoryByHandle(params.category)
const title = productCategory.name + " | Medusa Store" const title = productCategory.name
const description = productCategory.description ?? `${title} category.` const description = productCategory.description ?? `${title} category.`
return { return {
title: `${title} | Medusa Store`, title: `${title} | Suman d.o.o.`,
description, description,
alternates: { alternates: {
canonical: `${params.category.join("/")}`, canonical: `${params.category.join("/")}`,

View File

@@ -26,7 +26,7 @@ export async function generateMetadata(props: Props): Promise<Metadata> {
} }
const metadata = { const metadata = {
title: `${collection.title} | Medusa Store`, title: `${collection.title} | Suman d.o.o.`,
description: `${collection.title} collection`, description: `${collection.title} collection`,
} as Metadata } as Metadata

View File

@@ -1,24 +1,79 @@
import { Metadata } from "next" import { Metadata } from "next"
import { STORE_NAME } from "@lib/util/site" import { STORE_NAME } from "@lib/util/site"
import { PlaceholderNotice, PolicyPage } from "@modules/policies/templates" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import footerConfig from "@/config/footer.json"
export const dynamic = "force-static" export const dynamic = "force-static"
export const revalidate = 60 export const revalidate = 60
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Contact", title: "Kontakt",
description: `How to contact ${STORE_NAME}.`, description: `Kontakt i upiti za ${STORE_NAME}: telefon, email i adresa u Gračanici.`,
} }
export default function ContactPage() { export default function ContactPage() {
const { phone, email, address } = footerConfig.contact
const channels = [
{ label: "Telefon", value: phone, href: `tel:${phone.replace(/[^\d+]/g, "")}`, note: "Radnim danima" },
{ label: "Email", value: email, href: `mailto:${email}`, note: "Odgovor u roku od jednog radnog dana" },
{ label: "Proizvodnja i lager", value: address, href: null, note: "Lično preuzimanje narudžbi" },
]
return ( return (
<PolicyPage title="Contact"> <div className="content-container pb-24 sm:pb-32" data-testid="policy-page">
<PlaceholderNotice /> <header className="pt-14 sm:pt-20 pb-12 sm:pb-16 text-center">
<p> <p className="eyebrow">Kontakt</p>
Questions about an order, shipping or returns? Contact {STORE_NAME}{" "} <h1 className="display-heading mt-5 text-4xl sm:text-6xl text-foreground">Razgovarajmo</h1>
customer service and include your order number. <p className="mx-auto mt-5 max-w-xl text-sm sm:text-base text-muted-foreground leading-relaxed">
</p> Pitanje o narudžbi, dostavi ili opremanju terase? Javite se direktno proizvođaču.
</PolicyPage> </p>
</header>
<div className="grid grid-cols-1 md:grid-cols-3 rounded-2xl border border-border/80 divide-y md:divide-y-0 md:divide-x divide-border/80">
{channels.map((c) => (
<div key={c.label} className="flex flex-col justify-between gap-10 p-7 sm:p-9">
<p className="eyebrow text-muted-foreground">{c.label}</p>
<div>
{c.href ? (
<a href={c.href} className="font-display text-2xl text-foreground transition-colors hover:text-primary">
{c.value}
</a>
) : (
<p className="font-display text-2xl text-foreground">{c.value}</p>
)}
<p className="mt-2 text-sm text-muted-foreground">{c.note}</p>
</div>
</div>
))}
</div>
<section className="mt-16 sm:mt-24 grid grid-cols-1 lg:grid-cols-12 gap-8 border-t border-border/70 pt-12">
<p className="lg:col-span-4 eyebrow text-muted-foreground">Upiti za ponudu</p>
<div className="lg:col-span-8">
<h2 className="display-heading text-3xl sm:text-4xl text-foreground">
Pergole i tende izrađujemo po mjeri
</h2>
<p className="mt-4 max-w-xl text-sm sm:text-base text-muted-foreground leading-relaxed">
Na stranici svakog proizvoda možete poslati upit s odabranim opcijama. Naš tim dolazi na mjerenje i
priprema preciznu ponudu.
</p>
<div className="mt-7 flex flex-col sm:flex-row gap-3">
<LocalizedClientLink
href="/categories/pergole-i-bioklimatske-tende"
className="inline-flex h-11 items-center justify-center rounded-md bg-primary px-6 text-sm text-primary-foreground transition-colors hover:bg-primary/90"
>
Pergole
</LocalizedClientLink>
<LocalizedClientLink
href="/categories/tende"
className="inline-flex h-11 items-center justify-center rounded-md border border-border px-6 text-sm text-foreground transition-colors hover:bg-muted"
>
Tende
</LocalizedClientLink>
</div>
</div>
</section>
</div>
) )
} }

View File

@@ -1,20 +1,34 @@
import { Metadata } from "next" import { Metadata } from "next"
import InteractiveLink from "@modules/common/components/interactive-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "404", title: "404",
description: "Something went wrong", description: "Stranica nije pronađena.",
} }
export default function NotFound() { export default function NotFound() {
return ( return (
<div className="flex flex-col gap-4 items-center justify-center min-h-[calc(100vh-64px)]"> <div className="content-container flex min-h-[calc(100vh-64px)] flex-col items-center justify-center py-24 text-center">
<h1 className="text-2xl-semi text-ui-fg-base">Page not found</h1> <p className="eyebrow">Greška 404</p>
<p className="text-small-regular text-ui-fg-base"> <h1 className="display-heading mt-5 text-4xl sm:text-6xl text-foreground">Stranica nije pronađena</h1>
The page you tried to access does not exist. <p className="mt-5 max-w-md text-sm text-muted-foreground leading-relaxed">
Stranica koju tražite ne postoji ili je premještena.
</p> </p>
<InteractiveLink href="/">Go to frontpage</InteractiveLink> <div className="mt-8 flex flex-col sm:flex-row gap-3">
<LocalizedClientLink
href="/"
className="inline-flex h-11 items-center justify-center rounded-md bg-primary px-6 text-sm text-primary-foreground transition-colors hover:bg-primary/90"
>
Na početnu
</LocalizedClientLink>
<LocalizedClientLink
href="/store"
className="inline-flex h-11 items-center justify-center rounded-md border border-border px-6 text-sm text-foreground transition-colors hover:bg-muted"
>
Katalog proizvoda
</LocalizedClientLink>
</div>
</div> </div>
) )
} }

View File

@@ -7,8 +7,8 @@ type Props = {
params: Promise<{ id: string }> params: Promise<{ id: string }>
} }
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Order Confirmed", title: "Narudžba potvrđena",
description: "You purchase was successful", description: "Vaša narudžba je uspješno zaprimljena.",
} }
export default async function OrderConfirmedPage(props: Props) { export default async function OrderConfirmedPage(props: Props) {

View File

@@ -1,12 +1,12 @@
import { Metadata } from "next" import { Metadata } from "next"
import Hero from "@modules/home/components/hero" import LandingHero from "@modules/home/components/landing/hero"
import PartnersTicker from "@modules/home/components/partners-ticker" import LandingMission from "@modules/home/components/landing/mission"
import ProductShowcase from "@modules/home/components/product-showcase" import LandingMethod from "@modules/home/components/landing/method"
import MissionSection from "@modules/home/components/mission-section" import LandingProducts from "@modules/home/components/landing/products"
import CtaBanner from "@modules/home/components/cta-banner" import LandingStats from "@modules/home/components/landing/stats"
import LatestNews from "@modules/home/components/latest-news" import LandingImpact from "@modules/home/components/landing/impact"
import FaqSection from "@modules/home/components/faq-section" import LandingFaq from "@modules/home/components/landing/faq"
import { listCollections } from "@lib/data/collections" import { listCollections } from "@lib/data/collections"
import { getRegion, listRegions } from "@lib/data/regions" import { getRegion, listRegions } from "@lib/data/regions"
import { toJsonLd } from "@lib/util/product-structured-data" import { toJsonLd } from "@lib/util/product-structured-data"
@@ -94,13 +94,13 @@ export default async function Home(props: {
type="application/ld+json" type="application/ld+json"
dangerouslySetInnerHTML={{ __html: toJsonLd(structuredData) }} dangerouslySetInnerHTML={{ __html: toJsonLd(structuredData) }}
/> />
<Hero /> <LandingHero />
<PartnersTicker /> <LandingMission />
<ProductShowcase /> <LandingMethod />
<MissionSection /> <LandingProducts />
<CtaBanner /> <LandingStats />
<LatestNews /> <LandingImpact />
<FaqSection /> <LandingFaq />
</> </>
) )
} }

View File

@@ -7,22 +7,22 @@ export const dynamic = "force-static"
export const revalidate = 60 export const revalidate = 60
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Privacy policy", title: "Politika privatnosti",
description: `How ${STORE_NAME} collects and uses personal data.`, description: `Kako ${STORE_NAME} prikuplja i koristi lične podatke.`,
} }
export default function PrivacyPage() { export default function PrivacyPage() {
return ( return (
<PolicyPage title="Privacy policy"> <PolicyPage title="Politika privatnosti">
<PlaceholderNotice /> <PlaceholderNotice />
<p> <p>
{STORE_NAME} collects the information you provide at checkout, such as {STORE_NAME} prikuplja podatke koje unesete prilikom narudžbe, poput
your name, email address and shipping address, to process and deliver imena, email adrese i adrese dostave, kako bi obradio i isporučio vašu
your order. narudžbu.
</p> </p>
<p> <p>
Payment details are handled by our payment provider and are not stored Podatke o plaćanju obrađuje naš procesor plaćanja i trgovina ih ne
by the store. Cookies are used to keep your cart and sign-in session. čuva. Kolačići se koriste za čuvanje korpe i prijave na račun.
</p> </p>
</PolicyPage> </PolicyPage>
) )

View File

@@ -7,8 +7,8 @@ export const dynamic = "force-static"
export const revalidate = 60 export const revalidate = 60
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Return policy", title: "Povrat robe",
description: "How to return items and get a refund.", description: "Kako vratiti proizvod i dobiti povrat novca.",
} }
export default async function ReturnsPage(props: { export default async function ReturnsPage(props: {
@@ -18,17 +18,17 @@ export default async function ReturnsPage(props: {
const { current } = await getStorePolicies(countryCode) const { current } = await getStorePolicies(countryCode)
return ( return (
<PolicyPage title="Return policy"> <PolicyPage title="Povrat robe">
{current ? ( {current ? (
<> <>
<p> <p>
You can return items within {current.returnWindowDays} days of Proizvode možete vratiti u roku od {current.returnWindowDays} dana od
delivery. Items are returned by mail. isporuke. Povrat se šalje poštom.
</p> </p>
<p> <p>
{current.freeReturns {current.freeReturns
? "Return shipping is free." ? "Troškove povrata snosimo mi."
: "Return shipping costs are paid by the customer."} : "Troškove povrata snosi kupac."}
</p> </p>
</> </>
) : ( ) : (

View File

@@ -42,22 +42,22 @@ export default async function SearchPage(props: Props) {
return ( return (
<div className="content-container py-6" data-testid="search-container"> <div className="content-container py-6" data-testid="search-container">
<h1 className="text-2xl-semi mb-6"> <h1 className="font-display text-2xl mb-6">
{query ? `Search results for "${query}"` : "Search"} {query ? `Search results for "${query}"` : "Search"}
</h1> </h1>
<SearchForm countryCode={countryCode} defaultValue={query} className="mb-8 max-w-xl" /> <SearchForm countryCode={countryCode} defaultValue={query} className="mb-8 max-w-xl" />
{query && ( {query && (
<p className="text-small-regular text-ui-fg-subtle mb-6"> <p className="text-sm text-muted-foreground mb-6">
{response.count} {response.count === 1 ? "product" : "products"} found {response.count} {response.count === 1 ? "product" : "products"} found
</p> </p>
)} )}
{query && response.products.length === 0 ? ( {query && response.products.length === 0 ? (
<p className="text-ui-fg-subtle"> <p className="text-muted-foreground">
No products match your search. Try a different keyword. No products match your search. Try a different keyword.
</p> </p>
) : ( ) : (
<ul <ul
className="grid grid-cols-2 w-full small:grid-cols-3 medium:grid-cols-4 gap-x-6 gap-y-8" className="grid grid-cols-2 w-full lg:grid-cols-3 xl:grid-cols-4 gap-x-6 gap-y-8"
data-testid="search-results" data-testid="search-results"
> >
{response.products.map((product) => ( {response.products.map((product) => (

View File

@@ -11,8 +11,8 @@ export const dynamic = "force-static"
export const revalidate = 60 export const revalidate = 60
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Shipping information", title: "Dostava",
description: "Shipping rates and delivery times.", description: "Cijene i rokovi dostave.",
} }
export default async function ShippingPage(props: { export default async function ShippingPage(props: {
@@ -22,16 +22,16 @@ export default async function ShippingPage(props: {
const { current, currencyCode } = await getStorePolicies(countryCode) const { current, currencyCode } = await getStorePolicies(countryCode)
return ( return (
<PolicyPage title="Shipping information"> <PolicyPage title="Dostava">
{current ? ( {current ? (
<> <>
<p> <p>
Orders to {countryCode.toUpperCase()} ship with the following rates Za narudžbe u {countryCode.toUpperCase()} važe sljedeće cijene i rokovi
and delivery times. dostave.
</p> </p>
<ShippingSummary policies={current} currencyCode={currencyCode} /> <ShippingSummary policies={current} currencyCode={currencyCode} />
<p className="text-ui-fg-subtle"> <p className="text-muted-foreground">
Available shipping methods and final costs are shown at checkout. Dostupni načini dostave i konačna cijena prikazuju se u koraku plaćanja.
</p> </p>
</> </>
) : ( ) : (

View File

@@ -1,12 +1,16 @@
import { Metadata } from "next" import { Metadata } from "next"
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import { listProducts } from "@lib/data/products"
import { getRegion } from "@lib/data/regions" import { getRegion } from "@lib/data/regions"
import { getSaleInfo, SaleInfo } from "@lib/util/sale-scenario"
import CatalogHeader from "@modules/store/components/catalog-header"
import StoreTemplate from "@modules/store/templates" import StoreTemplate from "@modules/store/templates"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Store", title: "Katalog proizvoda",
description: "Explore all of our products.", description:
"Profesionalni suncobrani, bioklimatske pergole i tende iz vlastite proizvodnje.",
} }
export default async function StorePage(props: { export default async function StorePage(props: {
@@ -19,5 +23,29 @@ export default async function StorePage(props: {
notFound() notFound()
} }
return <StoreTemplate currencyCode={region.currency_code} /> // Search hits carry no metadata, so resolve each product's sale scenario here
const {
response: { products },
} = await listProducts({
countryCode,
queryParams: { limit: 100, fields: "handle,+metadata" },
})
const saleByHandle: Record<string, SaleInfo> = Object.fromEntries(
products
.filter((p) => p.handle)
.map((p) => [p.handle as string, getSaleInfo(p.metadata)])
)
return (
<div className="content-container pb-20 sm:pb-28" data-testid="category-container">
<CatalogHeader
kicker="Katalog"
title="Sistemi za zaštitu od sunca"
description="Suncobrani koje možete konfigurisati i naručiti online, te pergole i tende po mjeri vašeg prostora."
activeHandle={null}
titleTestId="store-page-title"
/>
<StoreTemplate currencyCode={region.currency_code} saleByHandle={saleByHandle} />
</div>
)
} }

View File

@@ -7,22 +7,22 @@ export const dynamic = "force-static"
export const revalidate = 60 export const revalidate = 60
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Terms of service", title: "Uslovi poslovanja",
description: `Terms that apply to purchases from ${STORE_NAME}.`, description: `Uslovi koji važe za kupovinu kod ${STORE_NAME}.`,
} }
export default function TermsPage() { export default function TermsPage() {
return ( return (
<PolicyPage title="Terms of service"> <PolicyPage title="Uslovi poslovanja">
<PlaceholderNotice /> <PlaceholderNotice />
<p> <p>
By placing an order with {STORE_NAME} you agree to these terms. Prices, Narudžbom kod {STORE_NAME} prihvatate ove uslove. Cijene, dostupnost
product availability and shipping options are shown on the product proizvoda i opcije dostave prikazane su na stranicama proizvoda i u
pages and at checkout, and may change without notice. koraku plaćanja, i mogu se mijenjati bez prethodne najave.
</p> </p>
<p> <p>
Orders are confirmed by email once payment is received. Returns and Narudžbe potvrđujemo emailom nakon prijema uplate. Povrat robe i novca
refunds are handled according to our return policy. rješavamo prema pravilima o povratu.
</p> </p>
</PolicyPage> </PolicyPage>
) )

View File

@@ -4,8 +4,8 @@ import { Suspense } from "react"
import VerifyAccount from "@modules/account/components/verify-account" import VerifyAccount from "@modules/account/components/verify-account"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "Verify your email", title: "Potvrda email adrese",
description: "Verify your email address to complete your registration.", description: "Potvrdite email adresu da završite registraciju.",
} }
export default function VerifyAccountPage() { export default function VerifyAccountPage() {
@@ -13,7 +13,7 @@ export default function VerifyAccountPage() {
<div className="w-full flex justify-center px-8 py-12"> <div className="w-full flex justify-center px-8 py-12">
<Suspense <Suspense
fallback={ fallback={
<p className="text-base-regular text-ui-fg-base"> <p className="text-base text-foreground">
Verifying your email... Verifying your email...
</p> </p>
} }

View File

@@ -1,22 +1,30 @@
import { getBaseURL } from "@lib/util/env" import { getBaseURL } from "@lib/util/env"
import { Metadata } from "next" import { Metadata } from "next"
import { Plus_Jakarta_Sans } from "next/font/google" import { DM_Sans, Geist } from "next/font/google"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
import "styles/globals.css" import "styles/globals.css"
const fontSans = Plus_Jakarta_Sans({ // Body text: closest free match to Biograph's Apercu Pro
const fontSans = DM_Sans({
subsets: ["latin", "latin-ext"], subsets: ["latin", "latin-ext"],
variable: "--font-sans", variable: "--font-sans",
display: "swap", display: "swap",
}) })
// Headings: closest free match to Biograph's Aeonik
const fontDisplay = Geist({
subsets: ["latin", "latin-ext"],
variable: "--font-display",
display: "swap",
})
export const metadata: Metadata = { export const metadata: Metadata = {
metadataBase: new URL(getBaseURL()), metadataBase: new URL(getBaseURL()),
} }
export default function RootLayout(props: { children: React.ReactNode }) { export default function RootLayout(props: { children: React.ReactNode }) {
return ( return (
<html lang="bs" data-mode="light" className={fontSans.variable}> <html lang="bs" data-mode="light" className={cn(fontSans.variable, fontDisplay.variable)}>
<head> <head>
<link rel="ucp" href="/.well-known/ucp" /> <link rel="ucp" href="/.well-known/ucp" />
</head> </head>

View File

@@ -1,7 +1,6 @@
import { ArrowRight } from "lucide-react" import { ArrowRight } from "lucide-react"
import { Metadata } from "next" import { Metadata } from "next"
import Link from "next/link" import Link from "next/link"
import { Button } from "@/components/ui/button"
export const metadata: Metadata = { export const metadata: Metadata = {
title: "404 - Stranica nije pronađena", title: "404 - Stranica nije pronađena",
@@ -11,20 +10,19 @@ export const metadata: Metadata = {
export default function NotFound() { export default function NotFound() {
return ( return (
<div className="flex flex-col items-center justify-center min-h-[70vh] text-center px-4"> <div className="flex flex-col items-center justify-center min-h-[70vh] text-center px-4">
<span className="text-sm font-semibold uppercase tracking-widest text-primary"> <p className="eyebrow">Greška 404</p>
Greška 404 <h1 className="display-heading mt-5 text-4xl sm:text-6xl text-foreground">
</span>
<h1 className="mt-2 text-3xl sm:text-4xl font-extrabold tracking-tight text-foreground">
Stranica nije pronađena Stranica nije pronađena
</h1> </h1>
<p className="mt-3 text-sm text-muted-foreground max-w-md"> <p className="mt-5 text-sm text-muted-foreground max-w-md leading-relaxed">
Stranica koju tražite ne postoji ili je premještena. Pregledajte naš asortiman suncobrana i pergola na početnoj stranici. Stranica koju tražite ne postoji ili je premještena. Pregledajte naš asortiman suncobrana i pergola na početnoj stranici.
</p> </p>
<Link href="/" className="mt-6"> <Link
<Button size="lg" className="gap-2"> href="/"
<span>Povratak na početnu</span> className="mt-8 inline-flex h-11 items-center gap-2 rounded-md bg-primary px-6 text-sm text-primary-foreground transition-colors hover:bg-primary/90"
<ArrowRight className="h-4 w-4" /> >
</Button> Povratak na početnu
<ArrowRight className="h-4 w-4" />
</Link> </Link>
</div> </div>
) )

View File

@@ -19,7 +19,7 @@ const DialogOverlay = React.forwardRef<
<DialogPrimitive.Overlay <DialogPrimitive.Overlay
ref={ref} ref={ref}
className={cn( className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className className
)} )}
{...props} {...props}
@@ -42,7 +42,7 @@ const DialogContent = React.forwardRef<
{...props} {...props}
> >
{children} {children}
<DialogPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-accent data-[state=open]:text-muted-foreground"> <DialogPrimitive.Close className="absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none">
<X className="h-4 w-4" /> <X className="h-4 w-4" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</DialogPrimitive.Close> </DialogPrimitive.Close>

View File

@@ -1,32 +1,28 @@
import Image from "next/image" import Image from "next/image"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
/** Intrinsic size of public/logo-suman.svg (viewBox 0 0 97 100) */
export const LOGO_WIDTH = 97
export const LOGO_HEIGHT = 100
export interface LogoProps { export interface LogoProps {
className?: string className?: string
width?: number
height?: number
priority?: boolean priority?: boolean
alt?: string alt?: string
} }
export function Logo({ /** Suman logo: navy square with the yellow wordmark and bottom strip */
className, export function Logo({ className, priority = false, alt = "Suman d.o.o." }: LogoProps) {
width = 160,
height = 68,
priority = true,
alt = "Suman d.o.o.",
}: LogoProps) {
return ( return (
<Image <Image
src="/logo.png" src="/logo-suman.svg"
alt={alt} alt={alt}
width={width} width={LOGO_WIDTH}
height={height} height={LOGO_HEIGHT}
priority={priority} priority={priority}
className={cn("h-9 w-auto object-contain transition-opacity duration-200 group-hover:opacity-90", className)} className={cn("h-auto w-full", className)}
/> />
) )
} }
export default Logo export default Logo

View File

@@ -20,7 +20,7 @@ const SheetOverlay = React.forwardRef<
>(({ className, ...props }, ref) => ( >(({ className, ...props }, ref) => (
<SheetPrimitive.Overlay <SheetPrimitive.Overlay
className={cn( className={cn(
"fixed inset-0 z-50 bg-black/80 data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0", "fixed inset-0 z-50 bg-black/40 backdrop-blur-[2px] data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0",
className className
)} )}
{...props} {...props}
@@ -63,7 +63,7 @@ const SheetContent = React.forwardRef<
className={cn(sheetVariants({ side }), className)} className={cn(sheetVariants({ side }), className)}
{...props} {...props}
> >
<SheetPrimitive.Close className="absolute right-4 top-4 rounded-sm opacity-70 ring-offset-background transition-opacity hover:opacity-100 focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:pointer-events-none data-[state=open]:bg-secondary"> <SheetPrimitive.Close className="absolute right-4 top-4 flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:bg-muted hover:text-foreground focus:outline-none focus-visible:ring-2 focus-visible:ring-ring disabled:pointer-events-none">
<X className="size-4" /> <X className="size-4" />
<span className="sr-only">Close</span> <span className="sr-only">Close</span>
</SheetPrimitive.Close> </SheetPrimitive.Close>

View File

@@ -0,0 +1,75 @@
{
"_readme": "Umbrella configurator. Layers are stacked bottom to top. To switch a layer from the SVG drawing to real photography, add its images under products.<handle>.images.<layerId>.<view>.<key> (or under default.images for all products). Key = selected value (e.g. 'Bordo Crvena'), '<size>|<value>' for a shape-specific image, or '*' for any value. All images of one product must be exported at canvas size with a transparent background. Add-on items get a real price and their own cart line once variantId points to a Medusa variant.",
"default": {
"canvas": { "width": 1600, "height": 1200 },
"views": ["side", "top"],
"layers": [
{ "id": "shadow", "fallback": "shadow", "views": ["side"] },
{ "id": "base", "fallback": "base", "driver": { "addon": "postolje" }, "views": ["side"] },
{ "id": "mast", "fallback": "mast", "driver": { "option": "frame" } },
{ "id": "canopy", "fallback": "canopy", "driver": { "option": "fabric" } },
{ "id": "led", "fallback": "led", "driver": { "addon": "oprema", "item": "led" }, "views": ["side"] },
{ "id": "heater", "fallback": "heater", "driver": { "addon": "oprema", "item": "grijac" }, "views": ["side"] }
],
"images": {},
"addons": [
{
"id": "postolje",
"title": "Postolje",
"description": "Kako će suncobran stajati na vašoj terasi.",
"type": "single",
"defaults": ["krizno"],
"items": [
{
"id": "krizno",
"label": "Križno postolje s pločama",
"description": "Čelični križ za betonske ploče, bez bušenja podloge."
},
{
"id": "mobilno",
"label": "Mobilno postolje s utezima",
"description": "Lako se premješta, za manje suncobrane.",
"incompatibleWith": ["3.5x3.5", "4x4", "4.5x4.5", "5x5", "6x6", "Ø 3.5", "Duo"],
"reason": "Prelagano za ovu dimenziju platna"
},
{
"id": "prirubnica",
"label": "Ugradna prirubnica",
"description": "Trajna ugradnja u betonsku podlogu, najveća stabilnost."
}
]
},
{
"id": "oprema",
"title": "Dodatna oprema",
"description": "Odaberite jednu ili više stavki.",
"type": "multi",
"items": [
{
"id": "led",
"label": "LED rasvjeta",
"description": "Integrisana rasvjeta u krakovima, za večernji rad terase."
},
{
"id": "grijac",
"label": "Infracrveni grijač",
"description": "Montira se na stub, produžava sezonu na terasi."
},
{
"id": "navlaka",
"label": "Zaštitna navlaka",
"description": "Štiti zatvoreno platno od prašine i vremenskih uslova."
}
]
}
]
},
"products": {
"suncobran-beach": {
"hideAddons": ["oprema"]
},
"suncobran-console": {
"hideAddons": ["postolje"]
}
}
}

View File

@@ -11,29 +11,65 @@
"brand": { "brand": {
"description": "Vodeći proizvođač profesionalnih ugostiteljskih suncobrana, bioklimatskih pergola i tendi u Bosni i Hercegovini. Tradicija kvaliteta i pouzdanosti.", "description": "Vodeći proizvođač profesionalnih ugostiteljskih suncobrana, bioklimatskih pergola i tendi u Bosni i Hercegovini. Tradicija kvaliteta i pouzdanosti.",
"socials": [ "socials": [
{ "name": "instagram", "href": "https://instagram.com" }, {
{ "name": "facebook", "href": "https://facebook.com" }, "name": "instagram",
{ "name": "x", "href": "https://twitter.com" }, "href": "https://instagram.com"
{ "name": "linkedin", "href": "https://linkedin.com" } },
{
"name": "facebook",
"href": "https://facebook.com"
},
{
"name": "x",
"href": "https://twitter.com"
},
{
"name": "linkedin",
"href": "https://linkedin.com"
}
] ]
}, },
"columns": [ "columns": [
{ {
"title": "Kompanija", "title": "Kompanija",
"links": [ "links": [
{ "title": "Početna", "href": "/" }, {
{ "title": "O Nama", "href": "/about" }, "title": "Početna",
{ "title": "Proizvodi", "href": "/store" }, "href": "/"
{ "title": "Reference", "href": "/categories/suncobrani" } },
{
"title": "Svi proizvodi",
"href": "/store"
},
{
"title": "Konfigurator suncobrana",
"href": "/categories/suncobrani"
},
{
"title": "Kontakt",
"href": "/contact"
}
] ]
}, },
{ {
"title": "Podrška", "title": "Podrška",
"links": [ "links": [
{ "title": "Naša Priča", "href": "/about" }, {
{ "title": "Dostava i Montaža", "href": "/shipping" }, "title": "Dostava",
{ "title": "Garancija i Servis", "href": "/terms" }, "href": "/shipping"
{ "title": "B2B Saradnja", "href": "/contact" } },
{
"title": "Povrat robe",
"href": "/returns"
},
{
"title": "Uslovi poslovanja",
"href": "/terms"
},
{
"title": "B2B saradnja",
"href": "/contact"
}
] ]
} }
], ],
@@ -46,8 +82,14 @@
"bottomBar": { "bottomBar": {
"copyright": "Suman d.o.o. Sva prava zadržana.", "copyright": "Suman d.o.o. Sva prava zadržana.",
"links": [ "links": [
{ "title": "Uvjeti korištenja", "href": "/terms" }, {
{ "title": "Politika privatnosti", "href": "/privacy" } "title": "Uslovi poslovanja",
"href": "/terms"
},
{
"title": "Politika privatnosti",
"href": "/privacy"
}
] ]
} }
} }

View File

@@ -0,0 +1,192 @@
{
"hero": {
"intervalMs": 7000,
"slides": [
{
"id": "suncobrani",
"kicker": "Suncobrani",
"title": "Najugodnije mjesto pod suncem",
"subtitle": "Profesionalni suncobrani iz vlastite proizvodnje u Gračanici. Odaberite dimenziju, platno i konstrukciju u konfiguratoru i naručite online.",
"image": "https://placehold.co/1920x1080/c9ced6/c9ced6",
"cta": {
"label": "Konfiguriši suncobran",
"href": "/categories/suncobrani"
},
"stats": [
{
"value": "UPF 50+",
"label": "UV zaštita platna"
},
{
"value": "do 6 × 6 m",
"label": "Raspon platna"
},
{
"value": "3–5 god.",
"label": "Garancija"
}
],
"overlay": 0
},
{
"id": "pergole",
"kicker": "Bioklimatske pergole",
"title": "Terasa za svako godišnje doba",
"subtitle": "Aluminijske pergole s pokretnim lamelama, izrađene po mjeri vašeg prostora i montirane od strane našeg tima.",
"image": "/hero/pergole-desktop.webp",
"cta": {
"label": "Pogledajte pergole",
"href": "/categories/pergole-i-bioklimatske-tende"
},
"stats": [
{
"value": "150 kg/m²",
"label": "Nosivost snijega"
},
{
"value": "do 13 m",
"label": "Raspon konstrukcije"
},
{
"value": "5 god.",
"label": "Garancija"
}
],
"overlay": 0.35
},
{
"id": "tende",
"kicker": "Tende",
"title": "Hlad tačno tamo gdje vam treba",
"subtitle": "Zglobne, kasetne i kupolaste tende za terase, balkone i izloge, uz mogućnost motorizacije i brendiranja.",
"image": "https://placehold.co/1920x1080/d6cfc5/d6cfc5",
"cta": {
"label": "Pogledajte tende",
"href": "/categories/tende"
},
"stats": [
{
"value": "0–45°",
"label": "Podesiv nagib"
},
{
"value": "do 6 m",
"label": "Širina tende"
},
{
"value": "Somfy",
"label": "Motorizacija"
}
],
"overlay": 0
}
]
},
"mission": {
"kicker": "Naša misija",
"title": "Uživajte u vanjskom prostoru, bez obzira na vrijeme",
"text": "Povezujemo inovaciju, preciznu proizvodnju i vrhunske materijale za dugotrajna rješenja zaštite od sunca. Ne pravimo samo hlad, nego prostor u kojem se gosti zadržavaju duže."
},
"method": {
"kicker": "Kako radimo",
"title": "Od ideje do montaže",
"text": "Svaki sistem prolazi isti put: vi birate konfiguraciju, mi ga izrađujemo u Gračanici i isporučujemo spremnog za upotrebu.",
"cta": {
"label": "Saznajte više",
"href": "/contact"
},
"steps": [
{
"title": "Odaberite i konfigurišite",
"text": "Izaberite model suncobrana, dimenzije, platno, boju konstrukcije i postolje. Pregled se mijenja uživo, a cijena se računa odmah.",
"image": "https://placehold.co/800x1000/d4d8de/8a919c?text=Konfigurator"
},
{
"title": "Izrada u našoj fabrici",
"text": "Konstrukcija od plastificiranog aluminija sa inox spojnim elementima. Tipski suncobrani i tende su spremni za 7 do 15 radnih dana.",
"image": "https://placehold.co/800x1000/d4d8de/8a919c?text=Proizvodnja"
},
{
"title": "Isporuka i podrška",
"text": "Dostava širom BiH ili lično preuzimanje u Gračanici. Rezervni dijelovi i nova platna su uvijek dostupni na našem lageru.",
"image": "https://placehold.co/800x1000/d4d8de/8a919c?text=Isporuka+i+montaza"
}
]
},
"products": {
"kicker": "Asortiman",
"title": "Sistemi za svaki prostor",
"featured": {
"kicker": "Suman suncobrani",
"title": "Konfigurišite i naručite direktno online",
"text": "Modeli Prestige, Magnum, Console i Advance u kvadratnom, pravougaonom ili okruglom obliku, sa preko deset dezena akrilnog platna.",
"image": "https://placehold.co/1200x1000/e8ebef/8a919c?text=Suncobran",
"href": "/categories/suncobrani",
"cta": "Pogledajte suncobrane",
"stats": [
{
"value": "4",
"label": "Modela"
},
{
"value": "10+",
"label": "Dezena platna"
},
{
"value": "4",
"label": "Boje konstrukcije"
}
]
},
"secondary": [
{
"kicker": "Bioklimatske pergole",
"title": "Pokretne lamele za potpunu kontrolu svjetla",
"text": "Izrađuju se po mjeri prostora. Pošaljite upit i naš tim će pripremiti ponudu.",
"image": "https://placehold.co/1000x700/e8ebef/8a919c?text=Pergola",
"href": "/categories/pergole-i-bioklimatske-tende",
"cta": "Pošaljite upit"
},
{
"kicker": "Tende",
"title": "Zglobne i kupolaste tende za terase i izloge",
"text": "Elegantna zaštita za privatne i ugostiteljske objekte, uz mogućnost brendiranja.",
"image": "https://placehold.co/1000x700/e8ebef/8a919c?text=Tenda",
"href": "/categories/tende",
"cta": "Pošaljite upit"
}
]
},
"stats": [
{
"value": "10.000",
"suffix": "+",
"text": "Instaliranih suncobrana, pergola i tendi na terasama, u hotelima i baštama širom regije i EU."
},
{
"value": "100",
"suffix": "%",
"text": "Aluminijska konstrukcija sa nehrđajućim inox spojnim elementima, bez dijelova koji hrđaju."
},
{
"value": "7–15",
"suffix": "",
"text": "Radnih dana je uobičajen rok isporuke za tipske suncobrane i zglobne tende."
}
],
"impact": {
"kicker": "Reference",
"title": "Na terasama širom regije",
"text": "Od malih kafića do hotelskih kompleksa, Suman sistemi su dio prostora u kojima ljudi provode ljeto.",
"image": "https://placehold.co/1920x1100/d4d8de/8a919c?text=Referentni+objekat"
},
"faq": {
"kicker": "Saznajte više",
"title": "Često postavljana pitanja",
"sideLabel": "01 — Sumanov pristup",
"cta": {
"label": "Postavite pitanje",
"href": "/contact"
}
}
}

View File

@@ -20,7 +20,7 @@
}, },
{ {
"title": "Pergole", "title": "Pergole",
"href": "/categories/pergole" "href": "/categories/pergole-i-bioklimatske-tende"
}, },
{ {
"title": "Tende", "title": "Tende",
@@ -42,7 +42,7 @@
}, },
{ {
"title": "Pergole", "title": "Pergole",
"href": "/categories/pergole" "href": "/categories/pergole-i-bioklimatske-tende"
}, },
{ {
"title": "Tende", "title": "Tende",

View File

@@ -0,0 +1,4 @@
{
"_readme": "Images for the quote configurator (pergole, tende). Left side shows the image of the step being read; in an option step it shows the image of the selected value. Per product handle: steps.<uvod|postupak|specifikacije|sazetak> = url, options.<option title>.<value> = url. Anything not set falls back to a generated placeholder. Recommended 1600x1200 (4:3), WebP.",
"products": {}
}

View File

@@ -0,0 +1,169 @@
import { HttpTypes } from "@medusajs/types"
import configuratorData from "@/config/configurator.json"
import {
AddonGroup,
AddonItem,
ConfiguratorConfig,
ConfiguratorOverride,
ConfiguratorView,
LayerDef,
LayerImages,
OptionDriver,
} from "./types"
export * from "./types"
/** Selected add-on items per group id */
export type AddonSelection = Record<string, string[]>
export type LayerContext = {
options: Partial<Record<OptionDriver, string>>
addons: AddonSelection
}
const data = configuratorData as unknown as {
default: ConfiguratorConfig
products: Record<string, ConfiguratorOverride>
}
function parseMetadataOverride(raw: unknown): ConfiguratorOverride | null {
if (!raw) return null
if (typeof raw === "object") return raw as ConfiguratorOverride
if (typeof raw === "string") {
try {
return JSON.parse(raw) as ConfiguratorOverride
} catch {
return null
}
}
return null
}
function mergeImages(...sources: (LayerImages | undefined)[]): LayerImages {
const out: LayerImages = {}
for (const src of sources) {
if (!src) continue
for (const [layerId, views] of Object.entries(src)) {
const target = (out[layerId] ??= {})
for (const [view, keys] of Object.entries(views ?? {})) {
target[view as ConfiguratorView] = {
...(target[view as ConfiguratorView] ?? {}),
...(keys ?? {}),
}
}
}
}
return out
}
/**
* Effective configurator config for a product:
* defaults <- products[handle] in configurator.json <- product.metadata.configurator
*/
export function getConfiguratorConfig(
product: HttpTypes.StoreProduct
): ConfiguratorConfig {
const base = data.default
const byHandle = product.handle ? data.products[product.handle] : undefined
const fromMetadata = parseMetadataOverride(product.metadata?.configurator)
const hidden = new Set([
...(byHandle?.hideAddons ?? []),
...(fromMetadata?.hideAddons ?? []),
])
const addons = (fromMetadata?.addons ?? byHandle?.addons ?? base.addons).filter(
(g) => !hidden.has(g.id)
)
return {
canvas: fromMetadata?.canvas ?? byHandle?.canvas ?? base.canvas,
views: fromMetadata?.views ?? byHandle?.views ?? base.views,
layers: fromMetadata?.layers ?? byHandle?.layers ?? base.layers,
images: mergeImages(base.images, byHandle?.images, fromMetadata?.images),
addons,
}
}
/** Whether a layer is drawn for the current view and selection */
export function isLayerActive(
layer: LayerDef,
view: ConfiguratorView,
ctx: LayerContext,
addonGroups: AddonGroup[]
) {
if (layer.views && !layer.views.includes(view)) return false
const driver = layer.driver
if (driver && "addon" in driver) {
// Layer belongs to an add-on group that this product does not offer
if (!addonGroups.some((g) => g.id === driver.addon)) return false
if ("item" in driver) return (ctx.addons[driver.addon] ?? []).includes(driver.item)
}
return true
}
/** Value that drives a layer, e.g. the selected fabric or base item */
export function getLayerValue(layer: LayerDef, ctx: LayerContext) {
const driver = layer.driver
if (!driver) return undefined
if ("option" in driver) return ctx.options[driver.option]
if ("item" in driver) return driver.item
return ctx.addons[driver.addon]?.[0]
}
/**
* Image for a layer, most specific key first:
* "<size>|<value>", "<value>", "<size>|*", "*". Undefined means: draw the SVG.
*/
export function resolveLayerImage(
config: ConfiguratorConfig,
layer: LayerDef,
view: ConfiguratorView,
ctx: LayerContext
) {
const keys = config.images[layer.id]?.[view]
if (!keys) return undefined
const value = getLayerValue(layer, ctx)
const size = ctx.options.size
const candidates = [
size && value ? `${size}|${value}` : null,
value ?? null,
size ? `${size}|*` : null,
"*",
].filter(Boolean) as string[]
for (const key of candidates) {
if (keys[key]) return keys[key]
}
return undefined
}
/** Reason the item cannot be picked with the current options, or null */
export function getAddonConflict(item: AddonItem, selectedValues: string[]) {
const hit = item.incompatibleWith?.find((needle) =>
selectedValues.some((v) => v.toLowerCase().includes(needle.toLowerCase()))
)
return hit ? item.reason ?? "Nije kompatibilno s odabranom konfiguracijom" : null
}
export function defaultAddonSelection(groups: AddonGroup[]): AddonSelection {
return Object.fromEntries(groups.map((g) => [g.id, g.defaults ?? []]))
}
/** "postolje:krizno;oprema:led,grijac" for shareable URLs */
export function encodeAddons(selection: AddonSelection) {
return Object.entries(selection)
.filter(([, items]) => items.length)
.map(([group, items]) => `${group}:${items.join(",")}`)
.join(";")
}
export function decodeAddons(raw: string | null, groups: AddonGroup[]): AddonSelection | null {
if (!raw) return null
const out = defaultAddonSelection(groups)
for (const part of raw.split(";")) {
const [groupId, items] = part.split(":")
const group = groups.find((g) => g.id === groupId)
if (!group || !items) continue
const valid = items.split(",").filter((id) => group.items.some((i) => i.id === id))
out[groupId] = group.type === "single" ? valid.slice(0, 1) : valid
}
return out
}

View File

@@ -0,0 +1,82 @@
/**
* Umbrella configurator schema.
*
* The preview is a stack of layers (bottom to top). Each layer is either an
* image (transparent PNG/WebP, all drawn on the same canvas size) or, while
* no image is set, a built-in SVG drawing. Images can be added per layer, per
* view and per selected value without code changes; see `configurator.json`.
*/
export type ConfiguratorView = "side" | "top"
/** Medusa product option kinds the configurator understands */
export type OptionDriver = "size" | "fabric" | "frame"
export type LayerDriver =
/** Image chosen by the selected value of a Medusa option */
| { option: OptionDriver }
/** Image chosen by the selected item of an add-on group */
| { addon: string }
/** Layer shown only when this add-on item is selected */
| { addon: string; item: string }
/** Built-in SVG fallback drawn when the layer has no image */
export type LayerFallback = "shadow" | "base" | "mast" | "canopy" | "led" | "heater"
export type LayerDef = {
id: string
fallback?: LayerFallback
driver?: LayerDriver
/** Views this layer appears in; defaults to all */
views?: ConfiguratorView[]
}
/**
* Layer images: layerId -> view -> key -> url.
* Key is the selected value that drives the layer (e.g. "Bordo Crvena"),
* "<size>|<value>" for a shape-specific image, or "*" for any value.
*/
export type LayerImages = Partial<
Record<string, Partial<Record<ConfiguratorView, Record<string, string>>>>
>
export type AddonItem = {
id: string
label: string
description?: string
/** Medusa variant added to the cart as its own line; enables a real price */
variantId?: string
/**
* Substrings of selected option values this item cannot be combined with,
* e.g. ["4x4", "5x5"] for a base that is too light for large canopies.
*/
incompatibleWith?: string[]
/** Shown when the item is disabled by `incompatibleWith` */
reason?: string
}
export type AddonGroup = {
id: string
title: string
description?: string
type: "single" | "multi"
/** Preselected item(s) */
defaults?: string[]
items: AddonItem[]
}
export type ConfiguratorConfig = {
/** Pixel size all layer images are exported at */
canvas: { width: number; height: number }
views: ConfiguratorView[]
layers: LayerDef[]
images: LayerImages
addons: AddonGroup[]
}
/** Partial override per product handle or from product.metadata.configurator */
export type ConfiguratorOverride = Partial<Omit<ConfiguratorConfig, "canvas">> & {
canvas?: ConfiguratorConfig["canvas"]
/** Add-on group ids to hide for this product */
hideAddons?: string[]
}

View File

@@ -0,0 +1,49 @@
import visualsData from "@/config/product-visuals.json"
/** Fixed steps of the quote configurator that have their own image */
export type VisualStep = "uvod" | "postupak" | "specifikacije" | "sazetak"
type ProductVisuals = {
steps?: Partial<Record<VisualStep, string>>
/** option title -> value -> url */
options?: Record<string, Record<string, string>>
}
const data = visualsData as unknown as { products: Record<string, ProductVisuals> }
const STEP_TEXT: Record<VisualStep, string> = {
uvod: "",
postupak: "Mjerenje i montaža",
specifikacije: "Detalji izrade",
sazetak: "",
}
function placeholder(text: string, bg = "d4d8de", fg = "6b7280") {
const t = encodeURIComponent(text).replace(/%20/g, "+")
return `https://placehold.co/1600x1200/${bg}/${fg}?text=${t}`
}
/** Image for a fixed step, or a placeholder named after the step */
export function getStepVisual(handle: string | null | undefined, title: string, step: VisualStep) {
const custom = handle ? data.products[handle]?.steps?.[step] : undefined
return custom ?? placeholder(STEP_TEXT[step] || title)
}
/**
* Image for an option value. Colour-like values get a placeholder in that
* colour (from `colorHex`), so changing e.g. the fabric visibly swaps it.
*/
export function getOptionVisual(
handle: string | null | undefined,
optionTitle: string,
value: string,
colorHex?: string,
isDark?: boolean
) {
const custom = handle ? data.products[handle]?.options?.[optionTitle]?.[value] : undefined
if (custom) return custom
if (colorHex?.startsWith("#")) {
return placeholder(`${optionTitle}: ${value}`, colorHex.slice(1), isDark ? "ffffff" : "1f2937")
}
return placeholder(`${optionTitle}: ${value}`)
}

View File

@@ -118,10 +118,13 @@ export async function addToCart({
variantId, variantId,
quantity, quantity,
countryCode, countryCode,
metadata,
}: { }: {
variantId: string variantId: string
quantity: number quantity: number
countryCode: string countryCode: string
/** Stored on the line item, e.g. the configurator selection */
metadata?: Record<string, unknown>
}) { }) {
if (!variantId) { if (!variantId) {
throw new Error("Missing variant ID when adding to cart") throw new Error("Missing variant ID when adding to cart")
@@ -143,6 +146,7 @@ export async function addToCart({
{ {
variant_id: variantId, variant_id: variantId,
quantity, quantity,
...(metadata ? { metadata } : {}),
}, },
{}, {},
headers headers

View File

@@ -0,0 +1,13 @@
/**
* How an option is presented: colour swatches, stacked size/model cards,
* or plain choice cards for everything else.
*/
export type OptionKind = "fabric" | "frame" | "size" | "choice"
export function getOptionKind(title?: string | null): OptionKind {
const t = (title ?? "").toLowerCase()
if (/konstrukcij|profil|frame/.test(t)) return "frame"
if (/boja|platn|dezen|color/.test(t)) return "fabric"
if (/dimenzij|izvedb|raspon|širin|sirin|veličin|velicin|size/.test(t)) return "size"
return "choice"
}

View File

@@ -0,0 +1,4 @@
/** "1 proizvod", "21 proizvod", "2 proizvoda", "12 proizvoda" */
export function productCount(n: number) {
return n % 10 === 1 && n % 100 !== 11 ? `${n} proizvod` : `${n} proizvoda`
}

View File

@@ -0,0 +1,158 @@
import { HttpTypes } from "@medusajs/types"
/**
* Sale scenarios set per product in Medusa Admin (product-inquiry widget):
* - in_stock: available now, add to cart
* - made_to_order: add to cart, delivered after `lead_time_days`
* - quote_only: no price or cart, customer sends an inquiry
*/
export type SaleScenario = "in_stock" | "made_to_order" | "quote_only"
export type SaleInfo = {
scenario: SaleScenario
/** Short status, e.g. "Na stanju" */
label: string
/** One line with delivery detail, e.g. "Isporuka za 14 dana" */
detail: string
leadTimeDays: number
allowCustomization: boolean
quoteSubtitle: string
/** Tailwind classes for the small status dot */
dotClass: string
}
type Metadata = Record<string, unknown> | null | undefined
export function getSaleInfo(metadata: Metadata): SaleInfo {
const raw = metadata?.sale_scenario
const scenario: SaleScenario =
raw === "quote_only" || raw === "made_to_order" ? raw : "in_stock"
const leadTimeDays = Number(metadata?.lead_time_days) || 14
const allowCustomization = Boolean(metadata?.allow_customization)
const quoteSubtitle =
(metadata?.quote_subtitle as string) ||
"Izrada po mjeri sa profesionalnom montažom i garancijom"
if (scenario === "quote_only") {
return {
scenario,
label: "Na upit",
detail: "Izrada po mjeri, cijena na upit",
leadTimeDays,
allowCustomization,
quoteSubtitle,
dotClass: "bg-primary",
}
}
if (scenario === "made_to_order") {
return {
scenario,
label: "Po narudžbi",
detail: `Isporuka za ${leadTimeDays} dana`,
leadTimeDays,
allowCustomization,
quoteSubtitle,
dotClass: "bg-amber-500",
}
}
return {
scenario,
label: "Na stanju",
detail: "Isporuka za 24–48h",
leadTimeDays,
allowCustomization,
quoteSubtitle,
dotClass: "bg-emerald-500",
}
}
/** Metadata keys that drive behaviour and are not shown as specs */
const CONTROL_KEYS = new Set([
"sale_scenario",
"lead_time_days",
"allow_customization",
"quote_subtitle",
"badge",
"custom_template",
"hero_image",
])
const SPEC_LABELS: Record<string, string> = {
fabric: "Platno",
fabric_weight: "Platno",
canvas: "Platno",
mast_diameter: "Stub",
mast_construction: "Stub",
ribs_profile: "Krakovi",
uv_protection: "UV zaštita",
water_column: "Vodeni stub",
wind_resistance: "Otpornost na vjetar",
wind_vent: "Lufter",
warranty_years: "Garancija",
opening_mechanism: "Mehanizam otvaranja",
rotation: "Rotacija",
free_space: "Slobodan prostor",
durability: "Izdržljivost",
design_system: "Dizajn",
special_feature: "Posebnost",
origin: "Porijeklo",
weight: "Težina",
motor: "Motorizacija",
profile: "Profil",
drainage: "Odvod vode",
lamellas: "Lamele",
snow_load: "Nosivost snijega",
automation: "Automatika",
construction: "Konstrukcija",
four_seasons: "Cjelogodišnje korištenje",
zip_compatible: "Kompatibilnost",
arms: "Ruke",
tilt_angle: "Nagib",
system: "Sistem",
insulation: "Izolacija",
frame: "Okvir",
branding: "Brendiranje",
options_available: "Dodatna oprema",
}
function prettifyKey(key: string) {
const text = key.replace(/_/g, " ")
return text.charAt(0).toUpperCase() + text.slice(1)
}
/** Human-readable spec rows from product metadata */
export function getProductSpecs(product: HttpTypes.StoreProduct) {
const metadata = (product.metadata ?? {}) as Record<string, unknown>
return Object.entries(metadata)
.filter(
([key, value]) =>
!CONTROL_KEYS.has(key) &&
(typeof value === "string" || typeof value === "number") &&
String(value).trim() !== ""
)
.map(([key, value]) => ({
key,
label: SPEC_LABELS[key] ?? prettifyKey(key),
value: String(value),
}))
}
/**
* Full-width hero image. Uses `metadata.hero_image` when set in Medusa Admin,
* otherwise a neutral placeholder until real photography is uploaded.
*/
export function getProductHeroImage(product: HttpTypes.StoreProduct) {
const custom = product.metadata?.hero_image
if (typeof custom === "string" && custom.trim()) {
return custom
}
return "https://placehold.co/2400x1350/c9ced6/c9ced6"
}
/** Card image for listings, same placeholder logic as the hero */
export function getProductCardImage(title?: string | null) {
const text = encodeURIComponent(title ?? "Suman").replace(/%20/g, "+")
return `https://placehold.co/900x1100/e8ebef/8a919c?text=${text}`
}

View File

@@ -22,7 +22,7 @@ const AccountInfo = ({
isSuccess, isSuccess,
isError, isError,
clearState, clearState,
errorMessage = "An error occurred, please try again", errorMessage = "Došlo je do greške, pokušajte ponovo",
children, children,
'data-testid': dataTestid 'data-testid': dataTestid
}: AccountInfoProps) => { }: AccountInfoProps) => {
@@ -42,28 +42,28 @@ const AccountInfo = ({
}, [isSuccess, close]) }, [isSuccess, close])
return ( return (
<div className="text-small-regular" data-testid={dataTestid}> <div className="py-6 text-sm" data-testid={dataTestid}>
<div className="flex items-end justify-between"> <div className="flex items-center justify-between gap-6">
<div className="flex flex-col"> <div className="flex min-w-0 flex-col gap-1.5">
<span className="uppercase text-ui-fg-base">{label}</span> <span className="eyebrow text-muted-foreground">{label}</span>
<div className="flex items-center flex-1 basis-0 justify-end gap-x-4"> <div className="text-base text-foreground">
{typeof currentInfo === "string" ? ( {typeof currentInfo === "string" ? (
<span className="font-semibold" data-testid="current-info">{currentInfo}</span> <span data-testid="current-info">{currentInfo}</span>
) : ( ) : (
currentInfo currentInfo
)} )}
</div> </div>
</div> </div>
<div> <div className="shrink-0">
<Button <Button
variant="secondary" variant="secondary"
className="w-[100px] min-h-[25px] py-1" className="h-9 w-[104px]"
onClick={handleToggle} onClick={handleToggle}
type={state ? "reset" : "button"} type={state ? "reset" : "button"}
data-testid="edit-button" data-testid="edit-button"
data-active={state} data-active={state}
> >
{state ? "Cancel" : "Edit"} {state ? "Odustani" : "Izmijeni"}
</Button> </Button>
</div> </div>
</div> </div>
@@ -82,7 +82,7 @@ const AccountInfo = ({
data-testid="success-message" data-testid="success-message"
> >
<Badge className="p-2 my-4" color="green"> <Badge className="p-2 my-4" color="green">
<span>{label} updated succesfully</span> <span>Sačuvano</span>
</Badge> </Badge>
</Disclosure.Panel> </Disclosure.Panel>
</Disclosure> </Disclosure>
@@ -117,16 +117,16 @@ const AccountInfo = ({
} }
)} )}
> >
<div className="flex flex-col gap-y-2 py-4"> <div className="flex flex-col gap-y-3 pt-5">
<div>{children}</div> <div>{children}</div>
<div className="flex items-center justify-end mt-2"> <div className="mt-2 flex items-center justify-end">
<Button <Button
isLoading={pending} isLoading={pending}
className="w-full small:max-w-[140px]" className="h-11 w-full sm:w-auto sm:px-6"
type="submit" type="submit"
data-testid="save-button" data-testid="save-button"
> >
Save changes Sačuvaj izmjene
</Button> </Button>
</div> </div>
</div> </div>

View File

@@ -1,121 +1,59 @@
"use client" "use client"
import { LogOut, User, MapPin, Package, ChevronRight } from "lucide-react"
import { useParams, usePathname } from "next/navigation" import { useParams, usePathname } from "next/navigation"
import { signout } from "@lib/data/customer" import { signout } from "@lib/data/customer"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
const AccountNav = ({ const NAV_LINKS = [
customer, { href: "/account", label: "Pregled" },
}: { { href: "/account/profile", label: "Profil" },
customer: HttpTypes.StoreCustomer | null { href: "/account/addresses", label: "Adrese" },
}) => { { href: "/account/orders", label: "Narudžbe" },
]
/** Account tabs, same pill style as the catalog category tabs */
const AccountNav = ({ customer: _customer }: { customer: HttpTypes.StoreCustomer | null }) => {
const route = usePathname() const route = usePathname()
const { countryCode } = useParams() as { countryCode: string } const { countryCode } = useParams() as { countryCode: string }
const handleLogout = async () => { const isActive = (href: string) => {
await signout(countryCode) const full = `/${countryCode}${href}`
// Order details live under /account/orders/details/...
return href === "/account" ? route === full : route.startsWith(full)
} }
const navLinks = [
{ href: "/account", label: "Pregled Naloga", icon: User },
{ href: "/account/profile", label: "Profil i Podaci", icon: User },
{ href: "/account/addresses", label: "Adrese za Isporuku", icon: MapPin },
{ href: "/account/orders", label: "Moje Narudžbe", icon: Package },
]
return ( return (
<div className="w-full"> <nav aria-label="Moj račun" className="flex justify-center" data-testid="account-nav">
{/* Mobile nav */} <div className="inline-flex max-w-full items-center gap-1 overflow-x-auto rounded-lg bg-muted p-1 text-sm">
<div className="sm:hidden" data-testid="mobile-account-nav"> {NAV_LINKS.map((link) => {
{route !== `/${countryCode}/account` ? ( const active = isActive(link.href)
<LocalizedClientLink return (
href="/account" <LocalizedClientLink
className="flex items-center gap-2 text-sm font-medium py-3 border-b border-border" key={link.href}
data-testid="account-main-link" href={link.href}
> aria-current={active ? "page" : undefined}
<ChevronRight className="h-4 w-4 rotate-180 text-muted-foreground" /> className={cn(
<span>Nazad na nalog</span> "whitespace-nowrap rounded-md px-4 py-2 transition-colors",
</LocalizedClientLink> active ? "bg-background text-foreground shadow-sm" : "text-muted-foreground hover:text-foreground"
) : ( )}
<div className="flex flex-col gap-3 py-4"> data-testid={link.href === "/account" ? "account-main-link" : undefined}
<h2 className="text-xl font-bold tracking-tight text-foreground">
Pozdrav, {customer?.first_name || "Korisnik"}
</h2>
<div className="flex flex-col divide-y divide-border rounded-xl border border-border bg-card">
{navLinks.map((link) => {
const Icon = link.icon
return (
<LocalizedClientLink
key={link.href}
href={link.href}
className="flex items-center justify-between p-4 text-sm font-medium text-foreground hover:bg-accent"
>
<div className="flex items-center gap-3">
<Icon className="h-4 w-4 text-muted-foreground" />
<span>{link.label}</span>
</div>
<ChevronRight className="h-4 w-4 text-muted-foreground" />
</LocalizedClientLink>
)
})}
<button
type="button"
className="flex items-center justify-between p-4 text-sm font-medium text-destructive hover:bg-destructive/10 text-left"
onClick={handleLogout}
data-testid="logout-button"
>
<div className="flex items-center gap-3">
<LogOut className="h-4 w-4" />
<span>Odjavi se</span>
</div>
</button>
</div>
</div>
)}
</div>
{/* Desktop nav */}
<div className="hidden sm:block" data-testid="account-nav">
<div className="flex flex-col gap-4 rounded-xl border border-border bg-card p-5">
<h3 className="text-sm font-semibold uppercase tracking-wider text-muted-foreground px-3">
Moj Nalog
</h3>
<nav className="flex flex-col gap-1">
{navLinks.map((link) => {
const Icon = link.icon
const active = route.endsWith(link.href)
return (
<LocalizedClientLink
key={link.href}
href={link.href}
className={cn(
"flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium transition-colors",
active
? "bg-primary text-primary-foreground shadow-sm"
: "text-muted-foreground hover:text-foreground hover:bg-muted"
)}
>
<Icon className="h-4 w-4" />
<span>{link.label}</span>
</LocalizedClientLink>
)
})}
<button
type="button"
onClick={handleLogout}
className="flex items-center gap-3 px-3 py-2 rounded-lg text-sm font-medium text-destructive hover:bg-destructive/10 transition-colors text-left mt-2 pt-2 border-t border-border"
data-testid="logout-button"
> >
<LogOut className="h-4 w-4" /> {link.label}
<span>Odjava</span> </LocalizedClientLink>
</button> )
</nav> })}
</div> <button
type="button"
onClick={() => signout(countryCode)}
className="whitespace-nowrap rounded-md px-4 py-2 text-muted-foreground transition-colors hover:text-destructive"
data-testid="logout-button"
>
Odjava
</button>
</div> </div>
</div> </nav>
) )
} }

View File

@@ -13,7 +13,7 @@ const AddressBook: React.FC<AddressBookProps> = ({ customer, region }) => {
const { addresses } = customer const { addresses } = customer
return ( return (
<div className="w-full"> <div className="w-full">
<div className="grid grid-cols-1 lg:grid-cols-2 gap-4 flex-1 mt-4"> <div className="grid flex-1 grid-cols-1 gap-4 sm:grid-cols-2">
<AddAddress region={region} addresses={addresses} /> <AddAddress region={region} addresses={addresses} />
{addresses.map((address) => { {addresses.map((address) => {
return ( return (

View File

@@ -47,31 +47,31 @@ const AddAddress = ({
return ( return (
<> <>
<button <button
className="border border-ui-border-base rounded-rounded p-5 min-h-[220px] h-full w-full flex flex-col justify-between" className="group flex h-full min-h-[200px] w-full flex-col justify-between rounded-2xl border border-dashed border-border p-6 text-left transition-colors hover:border-primary hover:bg-muted/50"
onClick={open} onClick={open}
data-testid="add-address-button" data-testid="add-address-button"
> >
<span className="text-base-semi">New address</span> <span className="font-display text-xl text-foreground">Nova adresa</span>
<Plus /> <Plus />
</button> </button>
<Modal isOpen={state} close={close} data-testid="add-address-modal"> <Modal isOpen={state} close={close} data-testid="add-address-modal">
<Modal.Title> <Modal.Title>
<Heading className="mb-2">Add address</Heading> <Heading className="font-display text-2xl font-normal">Nova adresa</Heading>
</Modal.Title> </Modal.Title>
<form action={formAction}> <form action={formAction}>
<Modal.Body> <Modal.Body>
<div className="flex flex-col gap-y-2"> <div className="flex flex-col gap-y-2">
<div className="grid grid-cols-2 gap-x-2"> <div className="grid grid-cols-2 gap-x-2">
<Input <Input
label="First name" label="Ime"
name="first_name" name="first_name"
required required
autoComplete="given-name" autoComplete="given-name"
data-testid="first-name-input" data-testid="first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="last_name" name="last_name"
required required
autoComplete="family-name" autoComplete="family-name"
@@ -79,34 +79,34 @@ const AddAddress = ({
/> />
</div> </div>
<Input <Input
label="Company" label="Firma"
name="company" name="company"
autoComplete="organization" autoComplete="organization"
data-testid="company-input" data-testid="company-input"
/> />
<Input <Input
label="Address" label="Adresa"
name="address_1" name="address_1"
required required
autoComplete="address-line1" autoComplete="address-line1"
data-testid="address-1-input" data-testid="address-1-input"
/> />
<Input <Input
label="Apartment, suite, etc." label="Stan, sprat i sl."
name="address_2" name="address_2"
autoComplete="address-line2" autoComplete="address-line2"
data-testid="address-2-input" data-testid="address-2-input"
/> />
<div className="grid grid-cols-[144px_1fr] gap-x-2"> <div className="grid grid-cols-[144px_1fr] gap-x-2">
<Input <Input
label="Postal code" label="Poštanski broj"
name="postal_code" name="postal_code"
required required
autoComplete="postal-code" autoComplete="postal-code"
data-testid="postal-code-input" data-testid="postal-code-input"
/> />
<Input <Input
label="City" label="Grad"
name="city" name="city"
required required
autoComplete="locality" autoComplete="locality"
@@ -114,7 +114,7 @@ const AddAddress = ({
/> />
</div> </div>
<Input <Input
label="Province / State" label="Kanton / entitet"
name="province" name="province"
autoComplete="address-level1" autoComplete="address-level1"
data-testid="state-input" data-testid="state-input"
@@ -127,7 +127,7 @@ const AddAddress = ({
data-testid="country-select" data-testid="country-select"
/> />
<Input <Input
label="Phone" label="Telefon"
name="phone" name="phone"
autoComplete="phone" autoComplete="phone"
data-testid="phone-input" data-testid="phone-input"
@@ -135,7 +135,7 @@ const AddAddress = ({
</div> </div>
{formState.error && ( {formState.error && (
<div <div
className="text-rose-500 text-small-regular py-2" className="text-rose-500 text-sm py-2"
data-testid="address-error" data-testid="address-error"
> >
{formState.error} {formState.error}
@@ -151,7 +151,7 @@ const AddAddress = ({
className="h-10" className="h-10"
data-testid="cancel-button" data-testid="cancel-button"
> >
Cancel Odustani
</Button> </Button>
<SubmitButton data-testid="save-button">Save</SubmitButton> <SubmitButton data-testid="save-button">Save</SubmitButton>
</div> </div>

View File

@@ -63,29 +63,29 @@ const EditAddress: React.FC<EditAddressProps> = ({
<> <>
<div <div
className={clx( className={clx(
"border rounded-rounded p-5 min-h-[220px] h-full w-full flex flex-col justify-between transition-colors", "flex h-full min-h-[200px] w-full flex-col justify-between rounded-2xl border border-border p-6 transition-colors",
{ {
"border-gray-900": isActive, "border-primary": isActive,
} }
)} )}
data-testid="address-container" data-testid="address-container"
> >
<div className="flex flex-col"> <div className="flex flex-col">
<Heading <Heading
className="text-left text-base-semi" className="text-left font-display text-xl font-normal"
data-testid="address-name" data-testid="address-name"
> >
{address.first_name} {address.last_name} {address.first_name} {address.last_name}
</Heading> </Heading>
{address.company && ( {address.company && (
<Text <Text
className="txt-compact-small text-ui-fg-base" className="text-sm text-foreground"
data-testid="address-company" data-testid="address-company"
> >
{address.company} {address.company}
</Text> </Text>
)} )}
<Text className="flex flex-col text-left text-base-regular mt-2"> <Text className="mt-3 flex flex-col text-left text-sm text-muted-foreground">
<span data-testid="address-address"> <span data-testid="address-address">
{address.address_1} {address.address_1}
{address.address_2 && <span>, {address.address_2}</span>} {address.address_2 && <span>, {address.address_2}</span>}
@@ -99,29 +99,29 @@ const EditAddress: React.FC<EditAddressProps> = ({
</span> </span>
</Text> </Text>
</div> </div>
<div className="flex items-center gap-x-4"> <div className="mt-6 flex items-center gap-x-5 border-t border-border/70 pt-4">
<button <button
className="text-small-regular text-ui-fg-base flex items-center gap-x-2" className="flex items-center gap-x-2 text-sm text-foreground transition-colors hover:text-primary"
onClick={open} onClick={open}
data-testid="address-edit-button" data-testid="address-edit-button"
> >
<Edit /> <Edit />
Edit Izmijeni
</button> </button>
<button <button
className="text-small-regular text-ui-fg-base flex items-center gap-x-2" className="flex items-center gap-x-2 text-sm text-muted-foreground transition-colors hover:text-destructive"
onClick={removeAddress} onClick={removeAddress}
data-testid="address-delete-button" data-testid="address-delete-button"
> >
{removing ? <Spinner /> : <Trash />} {removing ? <Spinner /> : <Trash />}
Remove Ukloni
</button> </button>
</div> </div>
</div> </div>
<Modal isOpen={state} close={close} data-testid="edit-address-modal"> <Modal isOpen={state} close={close} data-testid="edit-address-modal">
<Modal.Title> <Modal.Title>
<Heading className="mb-2">Edit address</Heading> <Heading className="font-display text-2xl font-normal">Izmjena adrese</Heading>
</Modal.Title> </Modal.Title>
<form action={formAction}> <form action={formAction}>
<input type="hidden" name="addressId" value={address.id} /> <input type="hidden" name="addressId" value={address.id} />
@@ -129,7 +129,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
<div className="grid grid-cols-1 gap-y-2"> <div className="grid grid-cols-1 gap-y-2">
<div className="grid grid-cols-2 gap-x-2"> <div className="grid grid-cols-2 gap-x-2">
<Input <Input
label="First name" label="Ime"
name="first_name" name="first_name"
required required
autoComplete="given-name" autoComplete="given-name"
@@ -137,7 +137,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
data-testid="first-name-input" data-testid="first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="last_name" name="last_name"
required required
autoComplete="family-name" autoComplete="family-name"
@@ -146,14 +146,14 @@ const EditAddress: React.FC<EditAddressProps> = ({
/> />
</div> </div>
<Input <Input
label="Company" label="Firma"
name="company" name="company"
autoComplete="organization" autoComplete="organization"
defaultValue={address.company || undefined} defaultValue={address.company || undefined}
data-testid="company-input" data-testid="company-input"
/> />
<Input <Input
label="Address" label="Adresa"
name="address_1" name="address_1"
required required
autoComplete="address-line1" autoComplete="address-line1"
@@ -161,7 +161,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
data-testid="address-1-input" data-testid="address-1-input"
/> />
<Input <Input
label="Apartment, suite, etc." label="Stan, sprat i sl."
name="address_2" name="address_2"
autoComplete="address-line2" autoComplete="address-line2"
defaultValue={address.address_2 || undefined} defaultValue={address.address_2 || undefined}
@@ -169,7 +169,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
/> />
<div className="grid grid-cols-[144px_1fr] gap-x-2"> <div className="grid grid-cols-[144px_1fr] gap-x-2">
<Input <Input
label="Postal code" label="Poštanski broj"
name="postal_code" name="postal_code"
required required
autoComplete="postal-code" autoComplete="postal-code"
@@ -177,7 +177,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
data-testid="postal-code-input" data-testid="postal-code-input"
/> />
<Input <Input
label="City" label="Grad"
name="city" name="city"
required required
autoComplete="locality" autoComplete="locality"
@@ -186,7 +186,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
/> />
</div> </div>
<Input <Input
label="Province / State" label="Kanton / entitet"
name="province" name="province"
autoComplete="address-level1" autoComplete="address-level1"
defaultValue={address.province || undefined} defaultValue={address.province || undefined}
@@ -201,7 +201,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
data-testid="country-select" data-testid="country-select"
/> />
<Input <Input
label="Phone" label="Telefon"
name="phone" name="phone"
autoComplete="phone" autoComplete="phone"
defaultValue={address.phone || undefined} defaultValue={address.phone || undefined}
@@ -209,7 +209,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
/> />
</div> </div>
{formState.error && ( {formState.error && (
<div className="text-rose-500 text-small-regular py-2"> <div className="text-rose-500 text-sm py-2">
{formState.error} {formState.error}
</div> </div>
)} )}
@@ -223,7 +223,7 @@ const EditAddress: React.FC<EditAddressProps> = ({
className="h-10" className="h-10"
data-testid="cancel-button" data-testid="cancel-button"
> >
Cancel Odustani
</Button> </Button>
<SubmitButton data-testid="save-button">Save</SubmitButton> <SubmitButton data-testid="save-button">Save</SubmitButton>
</div> </div>

View File

@@ -13,36 +13,37 @@ const Login = ({ setCurrentView }: Props) => {
const [message, formAction] = useActionState(login, null) const [message, formAction] = useActionState(login, null)
return ( return (
<div <div className="flex w-full max-w-sm flex-col" data-testid="login-page">
className="max-w-sm w-full flex flex-col items-center" <header className="text-center">
data-testid="login-page" <p className="eyebrow">Moj račun</p>
> <h1 className="display-heading mt-5 text-4xl sm:text-5xl text-foreground">Prijava</h1>
<h1 className="text-large-semi uppercase mb-6">Welcome back</h1> <p className="mt-4 text-sm text-muted-foreground">
<p className="text-center text-base-regular text-ui-fg-base mb-8"> Pratite narudžbe, sačuvajte adrese i naručujte brže.
Sign in to access an enhanced shopping experience. </p>
</p> </header>
{message?.state === "verification_required" && ( {message?.state === "verification_required" && (
<div <div
className="w-full mb-6 text-center text-base-regular text-ui-fg-base bg-ui-bg-subtle border border-ui-border-base rounded-rounded p-4" className="mt-8 rounded-lg bg-muted p-4 text-center text-sm text-foreground"
data-testid="login-verification-message" data-testid="login-verification-message"
> >
We sent a verification link to <strong>{message.email}</strong>. Poslali smo link za potvrdu na <strong>{message.email}</strong>. Potvrdite email, pa se prijavite.
Please verify your email, then sign in.
</div> </div>
)} )}
<form className="w-full" action={formAction}>
<div className="flex flex-col w-full gap-y-2"> <form className="mt-10 w-full" action={formAction}>
<div className="flex w-full flex-col gap-y-3">
<Input <Input
label="Email" label="Email"
name="email" name="email"
type="email" type="email"
title="Enter a valid email address." title="Unesite ispravnu email adresu."
autoComplete="email" autoComplete="email"
required required
data-testid="email-input" data-testid="email-input"
/> />
<Input <Input
label="Password" label="Lozinka"
name="password" name="password"
type="password" type="password"
autoComplete="current-password" autoComplete="current-password"
@@ -54,21 +55,21 @@ const Login = ({ setCurrentView }: Props) => {
error={message?.state === "error" ? message.error : null} error={message?.state === "error" ? message.error : null}
data-testid="login-error-message" data-testid="login-error-message"
/> />
<SubmitButton data-testid="sign-in-button" className="w-full mt-6"> <SubmitButton data-testid="sign-in-button" className="mt-6 h-12 w-full">
Sign in Prijava
</SubmitButton> </SubmitButton>
</form> </form>
<span className="text-center text-ui-fg-base text-small-regular mt-6">
Not a member?{" "} <p className="mt-8 border-t border-border/70 pt-6 text-center text-sm text-muted-foreground">
Nemate račun?{" "}
<button <button
onClick={() => setCurrentView(LOGIN_VIEW.REGISTER)} onClick={() => setCurrentView(LOGIN_VIEW.REGISTER)}
className="underline" className="text-primary underline underline-offset-4 hover:opacity-80"
data-testid="register-button" data-testid="register-button"
> >
Join us Registrujte se
</button> </button>
. </p>
</span>
</div> </div>
) )
} }

View File

@@ -1,85 +1,71 @@
import { Button } from "@modules/common/components/ui" import Image from "next/image"
import { useMemo } from "react" import { useMemo } from "react"
import Thumbnail from "@modules/products/components/thumbnail"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import { convertToLocale } from "@lib/util/money" import { convertToLocale } from "@lib/util/money"
import { getProductCardImage } from "@lib/util/sale-scenario"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { ArrowRight } from "lucide-react"
type OrderCardProps = { type OrderCardProps = {
order: HttpTypes.StoreOrder order: HttpTypes.StoreOrder
} }
const OrderCard = ({ order }: OrderCardProps) => { const OrderCard = ({ order }: OrderCardProps) => {
const numberOfLines = useMemo(() => { const itemCount = useMemo(
return ( () => order.items?.reduce((acc, item) => acc + item.quantity, 0) ?? 0,
order.items?.reduce((acc, item) => { [order]
return acc + item.quantity )
}, 0) ?? 0 const extra = (order.items?.length ?? 0) - 4
)
}, [order])
const numberOfProducts = useMemo(() => {
return order.items?.length ?? 0
}, [order])
return ( return (
<div className="bg-white flex flex-col" data-testid="order-card"> <div className="flex flex-col gap-5" data-testid="order-card">
<div className="uppercase text-large-semi mb-1"> <div className="flex flex-wrap items-baseline justify-between gap-3">
#<span data-testid="order-display-id">{order.display_id}</span> <p className="font-display text-2xl text-foreground">
#<span data-testid="order-display-id">{order.display_id}</span>
</p>
<p className="flex items-center gap-3 text-sm text-muted-foreground">
<span data-testid="order-created-at">
{new Date(order.created_at).toLocaleDateString("bs-BA", {
day: "numeric",
month: "long",
year: "numeric",
})}
</span>
<span aria-hidden="true">·</span>
<span>{itemCount % 10 === 1 && itemCount % 100 !== 11 ? `${itemCount} artikal` : `${itemCount} artikala`}</span>
<span aria-hidden="true">·</span>
<span className="text-foreground tabular-nums" data-testid="order-amount">
{convertToLocale({ amount: order.total, currency_code: order.currency_code })}
</span>
</p>
</div> </div>
<div className="flex items-center divide-x divide-gray-200 text-small-regular text-ui-fg-base">
<span className="pr-2" data-testid="order-created-at"> <ul className="grid grid-cols-4 gap-3">
{new Date(order.created_at).toDateString()} {order.items?.slice(0, 4).map((i) => (
</span> <li key={i.id} data-testid="order-item">
<span className="px-2" data-testid="order-amount"> <div className="relative aspect-[4/5] overflow-hidden rounded-lg bg-muted">
{convertToLocale({ <Image src={getProductCardImage(i.product_title ?? i.title)} alt="" fill sizes="160px" className="object-cover" />
amount: order.total,
currency_code: order.currency_code,
})}
</span>
<span className="pl-2">{`${numberOfLines} ${
numberOfLines > 1 ? "items" : "item"
}`}</span>
</div>
<div className="grid grid-cols-2 small:grid-cols-4 gap-4 my-4">
{order.items?.slice(0, 3).map((i) => {
return (
<div
key={i.id}
className="flex flex-col gap-y-2"
data-testid="order-item"
>
<Thumbnail thumbnail={i.thumbnail} images={[]} size="full" />
<div className="flex items-center text-small-regular text-ui-fg-base">
<span
className="text-ui-fg-base font-semibold"
data-testid="item-title"
>
{i.title}
</span>
<span className="ml-2">x</span>
<span data-testid="item-quantity">{i.quantity}</span>
</div>
</div> </div>
) <p className="mt-2 truncate text-xs text-foreground" data-testid="item-title">
})} {i.product_title ?? i.title}
{numberOfProducts > 4 && ( </p>
<div className="w-full h-full flex flex-col items-center justify-center"> <p className="text-xs text-muted-foreground">
<span className="text-small-regular text-ui-fg-base"> × <span data-testid="item-quantity">{i.quantity}</span>
+ {numberOfLines - 4} </p>
</span> </li>
<span className="text-small-regular text-ui-fg-base">more</span> ))}
</div> </ul>
)} {extra > 0 && <p className="-mt-2 text-xs text-muted-foreground">+ još {extra}</p>}
</div>
<div className="flex justify-end"> <LocalizedClientLink
<LocalizedClientLink href={`/account/orders/details/${order.id}`}> href={`/account/orders/details/${order.id}`}
<Button data-testid="order-details-link" variant="secondary"> className="group inline-flex items-center gap-2 self-start text-sm text-primary"
See details data-testid="order-details-link"
</Button> >
</LocalizedClientLink> Pogledaj detalje
</div> <ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
</LocalizedClientLink>
</div> </div>
) )
} }

View File

@@ -9,32 +9,29 @@ import { HttpTypes } from "@medusajs/types"
const OrderOverview = ({ orders }: { orders: HttpTypes.StoreOrder[] }) => { const OrderOverview = ({ orders }: { orders: HttpTypes.StoreOrder[] }) => {
if (orders?.length) { if (orders?.length) {
return ( return (
<div className="flex flex-col gap-y-8 w-full"> <ul className="w-full divide-y divide-border/70 border-y border-border/70">
{orders.map((o) => ( {orders.map((o) => (
<div <li key={o.id} className="py-8">
key={o.id}
className="border-b border-gray-200 pb-6 last:pb-0 last:border-none"
>
<OrderCard order={o} /> <OrderCard order={o} />
</div> </li>
))} ))}
</div> </ul>
) )
} }
return ( return (
<div <div
className="w-full flex flex-col items-center gap-y-4" className="w-full flex flex-col items-center gap-y-3 rounded-2xl bg-muted px-6 py-14 text-center"
data-testid="no-orders-container" data-testid="no-orders-container"
> >
<h2 className="text-large-semi">Nothing to see here</h2> <h2 className="font-display text-2xl text-foreground">Još nemate narudžbi</h2>
<p className="text-base-regular"> <p className="text-sm text-muted-foreground">
You don&apos;t have any orders yet, let us change that {":)"} Kad naručite, ovdje ćete pratiti status i isporuku.
</p> </p>
<div className="mt-4"> <div className="mt-4">
<LocalizedClientLink href="/" passHref> <LocalizedClientLink href="/store" passHref>
<Button data-testid="continue-shopping-button"> <Button data-testid="continue-shopping-button" className="h-11 px-6">
Continue shopping Nastavite kupovinu
</Button> </Button>
</LocalizedClientLink> </LocalizedClientLink>
</div> </div>

View File

@@ -1,167 +1,96 @@
import { Container } from "@modules/common/components/ui"
import ChevronDown from "@modules/common/icons/chevron-down"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import { convertToLocale } from "@lib/util/money" import { convertToLocale } from "@lib/util/money"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { ArrowRight } from "lucide-react"
type OverviewProps = { type OverviewProps = {
customer: HttpTypes.StoreCustomer | null customer: HttpTypes.StoreCustomer | null
orders: HttpTypes.StoreOrder[] | null orders: HttpTypes.StoreOrder[] | null
} }
const formatDate = (value: string | Date) =>
new Date(value).toLocaleDateString("bs-BA", { day: "numeric", month: "long", year: "numeric" })
const Overview = ({ customer, orders }: OverviewProps) => { const Overview = ({ customer, orders }: OverviewProps) => {
const stats = [
{ value: `${getProfileCompletion(customer)}%`, label: "Profil popunjen", href: "/account/profile", testId: "customer-profile-completion" },
{ value: String(customer?.addresses?.length ?? 0), label: "Sačuvane adrese", href: "/account/addresses", testId: "addresses-count" },
{ value: String(orders?.length ?? 0), label: "Narudžbe", href: "/account/orders", testId: "orders-count" },
]
return ( return (
<div data-testid="overview-page-wrapper"> <div data-testid="overview-page-wrapper">
<div className="hidden small:block"> <span className="sr-only" data-testid="welcome-message" data-value={customer?.first_name}>
<div className="text-xl-semi flex justify-between items-center mb-4"> Pozdrav {customer?.first_name}
<span data-testid="welcome-message" data-value={customer?.first_name}> </span>
Hello {customer?.first_name} <span className="sr-only" data-testid="customer-email" data-value={customer?.email}>
</span> {customer?.email}
<span className="text-small-regular text-ui-fg-base"> </span>
Signed in as:{" "}
<span
className="font-semibold"
data-testid="customer-email"
data-value={customer?.email}
>
{customer?.email}
</span>
</span>
</div>
<div className="flex flex-col py-8 border-t border-gray-200">
<div className="flex flex-col gap-y-4 h-full col-span-1 row-span-2 flex-1">
<div className="flex items-start gap-x-16 mb-6">
<div className="flex flex-col gap-y-4">
<h3 className="text-large-semi">Profile</h3>
<div className="flex items-end gap-x-2">
<span
className="text-3xl-semi leading-none"
data-testid="customer-profile-completion"
data-value={getProfileCompletion(customer)}
>
{getProfileCompletion(customer)}%
</span>
<span className="uppercase text-base-regular text-ui-fg-subtle">
Completed
</span>
</div>
</div>
<div className="flex flex-col gap-y-4"> <div className="grid grid-cols-1 sm:grid-cols-3 rounded-2xl border border-border/80 divide-y sm:divide-y-0 sm:divide-x divide-border/80">
<h3 className="text-large-semi">Addresses</h3> {stats.map((s) => (
<div className="flex items-end gap-x-2"> <LocalizedClientLink key={s.label} href={s.href} className="group flex flex-col justify-between gap-10 p-6 transition-colors hover:bg-muted/60">
<span <p className="font-display text-5xl text-primary" data-testid={s.testId} data-value={s.value}>
className="text-3xl-semi leading-none" {s.value}
data-testid="addresses-count" </p>
data-value={customer?.addresses?.length || 0} <p className="flex items-center justify-between text-sm text-muted-foreground">
> {s.label}
{customer?.addresses?.length || 0} <ArrowRight className="h-4 w-4 transition-transform group-hover:translate-x-0.5" />
</span> </p>
<span className="uppercase text-base-regular text-ui-fg-subtle"> </LocalizedClientLink>
Saved ))}
</span>
</div>
</div>
</div>
<div className="flex flex-col gap-y-4">
<div className="flex items-center gap-x-2">
<h3 className="text-large-semi">Recent orders</h3>
</div>
<ul
className="flex flex-col gap-y-4"
data-testid="orders-wrapper"
>
{orders && orders.length > 0 ? (
orders.slice(0, 5).map((order) => {
return (
<li
key={order.id}
data-testid="order-wrapper"
data-value={order.id}
>
<LocalizedClientLink
href={`/account/orders/details/${order.id}`}
>
<Container className="bg-gray-50 flex justify-between items-center p-4">
<div className="grid grid-cols-3 grid-rows-2 text-small-regular gap-x-4 flex-1">
<span className="font-semibold">Date placed</span>
<span className="font-semibold">
Order number
</span>
<span className="font-semibold">
Total amount
</span>
<span data-testid="order-created-date">
{new Date(order.created_at).toDateString()}
</span>
<span
data-testid="order-id"
data-value={order.display_id}
>
#{order.display_id}
</span>
<span data-testid="order-amount">
{convertToLocale({
amount: order.total,
currency_code: order.currency_code,
})}
</span>
</div>
<button
className="flex items-center justify-between"
data-testid="open-order-button"
>
<span className="sr-only">
Go to order #{order.display_id}
</span>
<ChevronDown className="-rotate-90" />
</button>
</Container>
</LocalizedClientLink>
</li>
)
})
) : (
<span data-testid="no-orders-message">No recent orders</span>
)}
</ul>
</div>
</div>
</div>
</div> </div>
<section className="mt-14">
<div className="mb-5 flex items-baseline justify-between">
<h3 className="font-display text-2xl text-foreground">Nedavne narudžbe</h3>
<LocalizedClientLink href="/account/orders" className="text-sm text-primary underline-offset-4 hover:underline">
Sve narudžbe
</LocalizedClientLink>
</div>
<ul className="divide-y divide-border/70 border-y border-border/70" data-testid="orders-wrapper">
{orders && orders.length > 0 ? (
orders.slice(0, 5).map((order) => (
<li key={order.id} data-testid="order-wrapper" data-value={order.id}>
<LocalizedClientLink
href={`/account/orders/details/${order.id}`}
className="group grid grid-cols-[1fr_auto] items-center gap-4 py-4 sm:grid-cols-[120px_1fr_auto_auto]"
data-testid="open-order-button"
>
<span className="text-sm text-foreground" data-testid="order-id" data-value={order.display_id}>
#{order.display_id}
</span>
<span className="hidden text-sm text-muted-foreground sm:block" data-testid="order-created-date">
{formatDate(order.created_at)}
</span>
<span className="text-sm text-foreground tabular-nums" data-testid="order-amount">
{convertToLocale({ amount: order.total, currency_code: order.currency_code })}
</span>
<ArrowRight className="hidden h-4 w-4 text-muted-foreground transition-transform group-hover:translate-x-0.5 sm:block" />
</LocalizedClientLink>
</li>
))
) : (
<li className="py-10 text-center text-sm text-muted-foreground" data-testid="no-orders-message">
Još nemate narudžbi.{" "}
<LocalizedClientLink href="/store" className="text-primary underline underline-offset-4">
Pogledajte katalog
</LocalizedClientLink>
</li>
)}
</ul>
</section>
</div> </div>
) )
} }
const getProfileCompletion = (customer: HttpTypes.StoreCustomer | null) => { const getProfileCompletion = (customer: HttpTypes.StoreCustomer | null) => {
if (!customer) return 0
let count = 0 let count = 0
if (customer.email) count++
if (!customer) { if (customer.first_name && customer.last_name) count++
return 0 if (customer.phone) count++
} if (customer.addresses?.find((addr) => addr.is_default_billing)) count++
if (customer.email) {
count++
}
if (customer.first_name && customer.last_name) {
count++
}
if (customer.phone) {
count++
}
const billingAddress = customer.addresses?.find(
(addr) => addr.is_default_billing
)
if (billingAddress) {
count++
}
return (count / 4) * 100 return (count / 4) * 100
} }

View File

@@ -63,7 +63,7 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
const currentInfo = useMemo(() => { const currentInfo = useMemo(() => {
if (!billingAddress) { if (!billingAddress) {
return "No billing address" return "Nema adrese za račun"
} }
const country = const country =
@@ -93,7 +93,7 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
<form action={formAction} onReset={() => clearState()} className="w-full"> <form action={formAction} onReset={() => clearState()} className="w-full">
<input type="hidden" name="addressId" value={billingAddress?.id} /> <input type="hidden" name="addressId" value={billingAddress?.id} />
<AccountInfo <AccountInfo
label="Billing address" label="Adresa za račun"
currentInfo={currentInfo} currentInfo={currentInfo}
isSuccess={successState} isSuccess={successState}
isError={!!state.error} isError={!!state.error}
@@ -103,14 +103,14 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
<div className="grid grid-cols-1 gap-y-2"> <div className="grid grid-cols-1 gap-y-2">
<div className="grid grid-cols-2 gap-x-2"> <div className="grid grid-cols-2 gap-x-2">
<Input <Input
label="First name" label="Ime"
name="first_name" name="first_name"
defaultValue={billingAddress?.first_name || undefined} defaultValue={billingAddress?.first_name || undefined}
required required
data-testid="billing-first-name-input" data-testid="billing-first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="last_name" name="last_name"
defaultValue={billingAddress?.last_name || undefined} defaultValue={billingAddress?.last_name || undefined}
required required
@@ -118,13 +118,13 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
/> />
</div> </div>
<Input <Input
label="Company" label="Firma"
name="company" name="company"
defaultValue={billingAddress?.company || undefined} defaultValue={billingAddress?.company || undefined}
data-testid="billing-company-input" data-testid="billing-company-input"
/> />
<Input <Input
label="Phone" label="Telefon"
name="phone" name="phone"
type="phone" type="phone"
autoComplete="phone" autoComplete="phone"
@@ -133,28 +133,28 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
data-testid="billing-phone-input" data-testid="billing-phone-input"
/> />
<Input <Input
label="Address" label="Adresa"
name="address_1" name="address_1"
defaultValue={billingAddress?.address_1 || undefined} defaultValue={billingAddress?.address_1 || undefined}
required required
data-testid="billing-address-1-input" data-testid="billing-address-1-input"
/> />
<Input <Input
label="Apartment, suite, etc." label="Stan, sprat i sl."
name="address_2" name="address_2"
defaultValue={billingAddress?.address_2 || undefined} defaultValue={billingAddress?.address_2 || undefined}
data-testid="billing-address-2-input" data-testid="billing-address-2-input"
/> />
<div className="grid grid-cols-[144px_1fr] gap-x-2"> <div className="grid grid-cols-[144px_1fr] gap-x-2">
<Input <Input
label="Postal code" label="Poštanski broj"
name="postal_code" name="postal_code"
defaultValue={billingAddress?.postal_code || undefined} defaultValue={billingAddress?.postal_code || undefined}
required required
data-testid="billing-postcal-code-input" data-testid="billing-postcal-code-input"
/> />
<Input <Input
label="City" label="Grad"
name="city" name="city"
defaultValue={billingAddress?.city || undefined} defaultValue={billingAddress?.city || undefined}
required required
@@ -162,7 +162,7 @@ const ProfileBillingAddress: React.FC<MyInformationProps> = ({
/> />
</div> </div>
<Input <Input
label="Province" label="Kanton"
name="province" name="province"
defaultValue={billingAddress?.province || undefined} defaultValue={billingAddress?.province || undefined}
data-testid="billing-province-input" data-testid="billing-province-input"

View File

@@ -48,7 +48,7 @@ const ProfileName: React.FC<MyInformationProps> = ({ customer }) => {
return ( return (
<form action={formAction} className="w-full overflow-visible"> <form action={formAction} className="w-full overflow-visible">
<AccountInfo <AccountInfo
label="Name" label="Ime i prezime"
currentInfo={`${customer.first_name} ${customer.last_name}`} currentInfo={`${customer.first_name} ${customer.last_name}`}
isSuccess={successState} isSuccess={successState}
isError={!!state?.error} isError={!!state?.error}
@@ -57,14 +57,14 @@ const ProfileName: React.FC<MyInformationProps> = ({ customer }) => {
> >
<div className="grid grid-cols-2 gap-x-4"> <div className="grid grid-cols-2 gap-x-4">
<Input <Input
label="First name" label="Ime"
name="first_name" name="first_name"
required required
defaultValue={customer.first_name ?? ""} defaultValue={customer.first_name ?? ""}
data-testid="first-name-input" data-testid="first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="last_name" name="last_name"
required required
defaultValue={customer.last_name ?? ""} defaultValue={customer.last_name ?? ""}

View File

@@ -16,7 +16,7 @@ const ProfilePassword: React.FC<MyInformationProps> = ({ customer: _customer })
// TODO: Add support for password updates // TODO: Add support for password updates
const updatePassword = async () => { const updatePassword = async () => {
// TODO: Re-add toast notification when Toaster component is implemented // TODO: Re-add toast notification when Toaster component is implemented
console.info("Password update is not implemented") console.info("Promjena lozinke trenutno nije dostupna")
} }
const clearState = () => { const clearState = () => {
@@ -30,7 +30,7 @@ const ProfilePassword: React.FC<MyInformationProps> = ({ customer: _customer })
className="w-full" className="w-full"
> >
<AccountInfo <AccountInfo
label="Password" label="Lozinka"
currentInfo={ currentInfo={
<span>The password is not shown for security reasons</span> <span>The password is not shown for security reasons</span>
} }
@@ -42,21 +42,21 @@ const ProfilePassword: React.FC<MyInformationProps> = ({ customer: _customer })
> >
<div className="grid grid-cols-2 gap-4"> <div className="grid grid-cols-2 gap-4">
<Input <Input
label="Old password" label="Stara lozinka"
name="old_password" name="old_password"
required required
type="password" type="password"
data-testid="old-password-input" data-testid="old-password-input"
/> />
<Input <Input
label="New password" label="Nova lozinka"
type="password" type="password"
name="new_password" name="new_password"
required required
data-testid="new-password-input" data-testid="new-password-input"
/> />
<Input <Input
label="Confirm password" label="Potvrdite lozinku"
type="password" type="password"
name="confirm_password" name="confirm_password"
required required

View File

@@ -47,7 +47,7 @@ const ProfileEmail: React.FC<MyInformationProps> = ({ customer }) => {
return ( return (
<form action={formAction} className="w-full"> <form action={formAction} className="w-full">
<AccountInfo <AccountInfo
label="Phone" label="Telefon"
currentInfo={`${customer.phone}`} currentInfo={`${customer.phone}`}
isSuccess={successState} isSuccess={successState}
isError={!!state.error} isError={!!state.error}
@@ -57,7 +57,7 @@ const ProfileEmail: React.FC<MyInformationProps> = ({ customer }) => {
> >
<div className="grid grid-cols-1 gap-y-2"> <div className="grid grid-cols-1 gap-y-2">
<Input <Input
label="Phone" label="Telefon"
name="phone" name="phone"
type="phone" type="phone"
autoComplete="phone" autoComplete="phone"

View File

@@ -16,37 +16,34 @@ const Register = ({ setCurrentView }: Props) => {
const [message, formAction] = useActionState(signup, null) const [message, formAction] = useActionState(signup, null)
return ( return (
<div <div className="flex w-full max-w-sm flex-col" data-testid="register-page">
className="max-w-sm flex flex-col items-center" <header className="mb-10 text-center">
data-testid="register-page" <p className="eyebrow">Moj račun</p>
> <h1 className="display-heading mt-5 text-4xl sm:text-5xl text-foreground">Registracija</h1>
<h1 className="text-large-semi uppercase mb-6"> <p className="mt-4 text-sm text-muted-foreground">
Become a Medusa Store Member Napravite račun za brže naručivanje i praćenje isporuke.
</h1> </p>
<p className="text-center text-base-regular text-ui-fg-base mb-4"> </header>
Create your Medusa Store Member profile, and get access to an enhanced
shopping experience.
</p>
{message?.state === "verification_required" && ( {message?.state === "verification_required" && (
<div <div
className="w-full mb-4 text-center text-base-regular text-ui-fg-base bg-ui-bg-subtle border border-ui-border-base rounded-rounded p-4" className="mb-6 w-full rounded-lg bg-muted p-4 text-center text-sm text-foreground"
data-testid="register-verification-message" data-testid="register-verification-message"
> >
We sent a verification link to <strong>{message.email}</strong>. Poslali smo link za potvrdu na <strong>{message.email}</strong>.
Please check your inbox to verify your email, then sign in. Potvrdite email, pa se prijavite.
</div> </div>
)} )}
<form className="w-full flex flex-col" action={formAction}> <form className="w-full flex flex-col" action={formAction}>
<div className="flex flex-col w-full gap-y-2"> <div className="flex flex-col w-full gap-y-3">
<Input <Input
label="First name" label="Ime"
name="first_name" name="first_name"
required required
autoComplete="given-name" autoComplete="given-name"
data-testid="first-name-input" data-testid="first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="last_name" name="last_name"
required required
autoComplete="family-name" autoComplete="family-name"
@@ -61,14 +58,14 @@ const Register = ({ setCurrentView }: Props) => {
data-testid="email-input" data-testid="email-input"
/> />
<Input <Input
label="Phone" label="Telefon"
name="phone" name="phone"
type="tel" type="tel"
autoComplete="tel" autoComplete="tel"
data-testid="phone-input" data-testid="phone-input"
/> />
<Input <Input
label="Password" label="Lozinka"
name="password" name="password"
required required
type="password" type="password"
@@ -80,37 +77,36 @@ const Register = ({ setCurrentView }: Props) => {
error={message?.state === "error" ? message.error : null} error={message?.state === "error" ? message.error : null}
data-testid="register-error" data-testid="register-error"
/> />
<span className="text-center text-ui-fg-base text-small-regular mt-6"> <span className="mt-6 text-center text-xs text-muted-foreground">
By creating an account, you agree to Medusa Store&apos;s{" "} Registracijom prihvatate{" "}
<LocalizedClientLink <LocalizedClientLink
href="/content/privacy-policy" href="/privacy"
className="underline" className="underline"
> >
Privacy Policy Politikom privatnosti
</LocalizedClientLink>{" "} </LocalizedClientLink>{" "}
and{" "} i{" "}
<LocalizedClientLink <LocalizedClientLink
href="/content/terms-of-use" href="/terms"
className="underline" className="underline"
> >
Terms of Use Uslovima korištenja
</LocalizedClientLink> </LocalizedClientLink>
. .
</span> </span>
<SubmitButton className="w-full mt-6" data-testid="register-button"> <SubmitButton className="mt-6 h-12 w-full" data-testid="register-button">
Join Registracija
</SubmitButton> </SubmitButton>
</form> </form>
<span className="text-center text-ui-fg-base text-small-regular mt-6"> <p className="mt-8 border-t border-border/70 pt-6 text-center text-sm text-muted-foreground">
Already a member?{" "} Već imate račun?{" "}
<button <button
onClick={() => setCurrentView(LOGIN_VIEW.SIGN_IN)} onClick={() => setCurrentView(LOGIN_VIEW.SIGN_IN)}
className="underline" className="text-primary underline underline-offset-4 hover:opacity-80"
> >
Sign in Prijava
</button> </button>
. </p>
</span>
</div> </div>
) )
} }

View File

@@ -0,0 +1,17 @@
/** Title + short description at the top of each account screen */
export default function SectionHeading({
title,
description,
}: {
title: string
description?: string
}) {
return (
<div className="mb-10 text-center">
<h2 className="display-heading text-3xl sm:text-4xl text-foreground">{title}</h2>
{description && (
<p className="mx-auto mt-3 max-w-lg text-sm text-muted-foreground leading-relaxed">{description}</p>
)}
</div>
)
}

View File

@@ -27,11 +27,11 @@ export default function TransferRequestForm() {
<div className="grid sm:grid-cols-2 items-center gap-x-8 gap-y-4 w-full"> <div className="grid sm:grid-cols-2 items-center gap-x-8 gap-y-4 w-full">
<div className="flex flex-col gap-y-1"> <div className="flex flex-col gap-y-1">
<Heading level="h3" className="!text-sm font-semibold text-neutral-950"> <Heading level="h3" className="!text-sm font-semibold text-neutral-950">
Order transfers Prijenos narudžbi
</Heading> </Heading>
<p className="text-small-regular text-neutral-500"> <p className="text-sm text-neutral-500">
Can&apos;t find the order you are looking for? Ne vidite narudžbu koju tražite?
<br /> Connect an order to your account. <br /> Povežite narudžbu sa svojim računom.
</p> </p>
</div> </div>
<form <form
@@ -39,31 +39,31 @@ export default function TransferRequestForm() {
className="flex flex-col gap-y-1 sm:items-end" className="flex flex-col gap-y-1 sm:items-end"
> >
<div className="flex flex-col gap-y-2 w-full"> <div className="flex flex-col gap-y-2 w-full">
<Input className="w-full" name="order_id" placeholder="Order ID" /> <Input className="w-full" name="order_id" placeholder="Broj narudžbe" />
<SubmitButton <SubmitButton
variant="secondary" variant="secondary"
size="small" size="small"
className="w-fit whitespace-nowrap self-end" className="w-fit whitespace-nowrap self-end"
> >
Request transfer Zatraži prijenos
</SubmitButton> </SubmitButton>
</div> </div>
</form> </form>
</div> </div>
{!state.success && state.error && ( {!state.success && state.error && (
<Text className="text-base-regular text-rose-500 text-right"> <Text className="text-base text-rose-500 text-right">
{state.error} {state.error}
</Text> </Text>
)} )}
{showSuccess && ( {showSuccess && (
<div className="flex justify-between p-4 bg-neutral-50 shadow-borders-base w-full self-stretch items-center"> <div className="flex justify-between p-4 bg-neutral-50 border border-border w-full self-stretch items-center">
<div className="flex gap-x-2 items-center"> <div className="flex gap-x-2 items-center">
<CheckCircleMiniSolid className="w-4 h-4 text-emerald-500" /> <CheckCircleMiniSolid className="w-4 h-4 text-emerald-500" />
<div className="flex flex-col gap-y-1"> <div className="flex flex-col gap-y-1">
<Text className="text-medim-pl text-neutral-950"> <Text className="text-medim-pl text-neutral-950">
Transfer for order {state.order?.id} requested Transfer for order {state.order?.id} requested
</Text> </Text>
<Text className="text-base-regular text-neutral-600"> <Text className="text-base text-neutral-600">
Transfer request email sent to {state.order?.email} Transfer request email sent to {state.order?.email}
</Text> </Text>
</div> </div>

View File

@@ -37,33 +37,33 @@ const VerifyAccount = () => {
className="max-w-sm w-full flex flex-col items-center text-center gap-y-4" className="max-w-sm w-full flex flex-col items-center text-center gap-y-4"
data-testid="verify-account-page" data-testid="verify-account-page"
> >
<h1 className="text-large-semi uppercase">Email verification</h1> <h1 className="text-lg font-medium uppercase">Email verification</h1>
{state === "verifying" && ( {state === "verifying" && (
<p className="text-base-regular text-ui-fg-base"> <p className="text-base text-foreground">
Verifying your email... Potvrđujemo vašu email adresu…
</p> </p>
)} )}
{state === "success" && ( {state === "success" && (
<> <>
<p className="text-base-regular text-ui-fg-base"> <p className="text-base text-foreground">
Your email is verified. You can now sign in to your account. Email adresa je potvrđena. Sada se možete prijaviti na svoj račun.
</p> </p>
<LocalizedClientLink href="/account"> <LocalizedClientLink href="/account">
<Button variant="primary">Go to sign in</Button> <Button variant="primary">Na prijavu</Button>
</LocalizedClientLink> </LocalizedClientLink>
</> </>
)} )}
{state === "error" && ( {state === "error" && (
<> <>
<p className="text-base-regular text-ui-fg-base"> <p className="text-base text-foreground">
This verification link is invalid or has expired. Sign in to receive Link za potvrdu nije ispravan ili je istekao. Prijavite se da dobijete
a new verification email. novi email za potvrdu.
</p> </p>
<LocalizedClientLink href="/account"> <LocalizedClientLink href="/account">
<Button variant="secondary">Go to sign in</Button> <Button variant="secondary">Na prijavu</Button>
</LocalizedClientLink> </LocalizedClientLink>
</> </>
)} )}

View File

@@ -1,7 +1,6 @@
import React from "react" import React from "react"
import UnderlineLink from "@modules/common/components/interactive-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import AccountNav from "../components/account-nav" import AccountNav from "../components/account-nav"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
@@ -10,31 +9,46 @@ interface AccountLayoutProps {
children: React.ReactNode children: React.ReactNode
} }
const AccountLayout: React.FC<AccountLayoutProps> = ({ /**
customer, * Signed out: the login/register screen is centred on its own.
children, * Signed in: centred greeting, tab navigation, one readable content column.
}) => { */
const AccountLayout: React.FC<AccountLayoutProps> = ({ customer, children }) => {
if (!customer) {
return (
<div className="w-full" data-testid="account-page">
{children}
</div>
)
}
return ( return (
<div className="flex-1 small:py-12" data-testid="account-page"> <div className="content-container pb-20 sm:pb-28" data-testid="account-page">
<div className="flex-1 content-container h-full max-w-5xl mx-auto bg-white flex flex-col"> <header className="pt-14 sm:pt-20 pb-10 text-center">
<div className="grid grid-cols-1 small:grid-cols-[240px_1fr] py-12"> <p className="eyebrow">Moj račun</p>
<div>{customer && <AccountNav customer={customer} />}</div> <h1 className="display-heading mt-5 text-4xl sm:text-6xl text-foreground">
<div className="flex-1">{children}</div> Pozdrav, {customer.first_name || "dobro došli"}
</div> </h1>
<div className="flex flex-col small:flex-row items-end justify-between small:border-t border-gray-200 py-12 gap-8"> <p className="mt-4 text-sm text-muted-foreground">{customer.email}</p>
<div> </header>
<h3 className="text-xl-semi mb-4">Got questions?</h3>
<span className="txt-medium"> <AccountNav customer={customer} />
You can find frequently asked questions and answers on our
customer service page. <div className="mx-auto mt-12 w-full max-w-3xl">{children}</div>
</span>
</div> <div className="mx-auto mt-20 flex max-w-3xl flex-col items-start justify-between gap-4 border-t border-border/70 pt-8 sm:flex-row sm:items-center">
<div> <div>
<UnderlineLink href="/customer-service"> <p className="text-sm text-foreground">Imate pitanja?</p>
Customer Service <p className="mt-1 text-sm text-muted-foreground">
</UnderlineLink> Pišite nam ili nas nazovite, odgovaramo u roku od jednog radnog dana.
</div> </p>
</div> </div>
<LocalizedClientLink
href="/contact"
className="inline-flex h-10 shrink-0 items-center rounded-md border border-border px-5 text-sm text-foreground transition-colors hover:bg-muted"
>
Kontakt
</LocalizedClientLink>
</div> </div>
</div> </div>
) )

View File

@@ -14,7 +14,7 @@ const LoginTemplate = () => {
const [currentView, setCurrentView] = useState("sign-in") const [currentView, setCurrentView] = useState("sign-in")
return ( return (
<div className="w-full flex justify-start px-8 py-8"> <div className="content-container flex w-full justify-center py-16 sm:py-24">
{currentView === "sign-in" ? ( {currentView === "sign-in" ? (
<Login setCurrentView={setCurrentView} /> <Login setCurrentView={setCurrentView} />
) : ( ) : (

View File

@@ -42,10 +42,10 @@ const CartItemSelect = forwardRef<HTMLSelectElement, NativeSelectProps>(
onFocus={() => innerRef.current?.focus()} onFocus={() => innerRef.current?.focus()}
onBlur={() => innerRef.current?.blur()} onBlur={() => innerRef.current?.blur()}
className={clx( className={clx(
"relative flex items-center txt-compact-small border text-ui-fg-base group", "relative flex items-center text-sm border text-foreground group",
className, className,
{ {
"text-ui-fg-subtle": isPlaceholder, "text-muted-foreground": isPlaceholder,
} }
)} )}
> >

View File

@@ -1,28 +1,30 @@
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import { Button } from "@/components/ui/button"
import { ShoppingBag, ArrowRight } from "lucide-react"
const EmptyCartMessage = () => { const EmptyCartMessage = () => {
return ( return (
<div <div
className="py-24 sm:py-32 flex flex-col items-center justify-center text-center max-w-md mx-auto" className="mx-auto flex max-w-md flex-col items-center py-28 sm:py-36 text-center"
data-testid="empty-cart-message" data-testid="empty-cart-message"
> >
<div className="h-16 w-16 rounded-full bg-muted flex items-center justify-center text-muted-foreground mb-4"> <p className="eyebrow">Korpa</p>
<ShoppingBag className="h-8 w-8" /> <h1 className="display-heading mt-5 text-4xl sm:text-5xl text-foreground">Korpa je prazna</h1>
</div> <p className="mt-5 text-sm text-muted-foreground leading-relaxed">
<h1 className="text-2xl sm:text-3xl font-bold tracking-tight text-foreground"> Konfigurišite suncobran po svojoj mjeri ili pogledajte pergole i tende iz naše proizvodnje.
Vaša korpa je prazna
</h1>
<p className="mt-2 text-sm text-muted-foreground leading-relaxed">
Trenutno nemate dodanih proizvoda u korpi. Istražite našu ponudu profesionalnih suncobrana, pergola i opreme za zaštitu od sunca.
</p> </p>
<LocalizedClientLink href="/store" className="mt-6"> <div className="mt-8 flex flex-col sm:flex-row gap-3">
<Button size="lg" className="gap-2"> <LocalizedClientLink
<span>Pregledaj Katalog</span> href="/categories/suncobrani"
<ArrowRight className="h-4 w-4" /> className="inline-flex h-11 items-center justify-center rounded-md bg-primary px-6 text-sm text-primary-foreground transition-colors hover:bg-primary/90"
</Button> >
</LocalizedClientLink> Konfiguriši suncobran
</LocalizedClientLink>
<LocalizedClientLink
href="/store"
className="inline-flex h-11 items-center justify-center rounded-md border border-border px-6 text-sm text-foreground transition-colors hover:bg-muted"
>
Pogledajte katalog
</LocalizedClientLink>
</div>
</div> </div>
) )
} }

View File

@@ -1,139 +1,143 @@
"use client" "use client"
import { Table } from "@modules/common/components/ui" import Image from "next/image"
import { updateLineItem } from "@lib/data/cart" import { updateLineItem, deleteLineItem } from "@lib/data/cart"
import { notifyCartUpdated } from "@lib/util/cart-events"
import { convertToLocale } from "@lib/util/money"
import { getProductCardImage } from "@lib/util/sale-scenario"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import CartItemSelect from "@modules/cart/components/cart-item-select"
import ErrorMessage from "@modules/checkout/components/error-message" import ErrorMessage from "@modules/checkout/components/error-message"
import DeleteButton from "@modules/common/components/delete-button"
import LineItemOptions from "@modules/common/components/line-item-options" import LineItemOptions from "@modules/common/components/line-item-options"
import LineItemPrice from "@modules/common/components/line-item-price"
import LineItemUnitPrice from "@modules/common/components/line-item-unit-price"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import Thumbnail from "@modules/products/components/thumbnail"
import { useState } from "react" import { useState } from "react"
import { Loader2 } from "lucide-react" import { Loader2, Minus, Plus } from "lucide-react"
import { cn } from "@/lib/utils" import { cn } from "@/lib/utils"
type ItemProps = { type ItemProps = {
item: HttpTypes.StoreCartLineItem item: HttpTypes.StoreCartLineItem
/** full: cart page with quantity controls; preview: checkout summary */
type?: "full" | "preview" type?: "full" | "preview"
currencyCode: string currencyCode: string
} }
const MAX_QUANTITY = 99
/** Cart line as a list row (cart page and checkout summary) */
const Item = ({ item, type = "full", currencyCode }: ItemProps) => { const Item = ({ item, type = "full", currencyCode }: ItemProps) => {
const [updating, setUpdating] = useState(false) const [updating, setUpdating] = useState(false)
const [removing, setRemoving] = useState(false)
const [error, setError] = useState<string | null>(null) const [error, setError] = useState<string | null>(null)
const isFull = type === "full"
const money = (amount?: number | null) =>
convertToLocale({ amount: amount ?? 0, currency_code: currencyCode })
const changeQuantity = async (quantity: number) => { const changeQuantity = async (quantity: number) => {
if (quantity < 1 || quantity > MAX_QUANTITY) return
setError(null) setError(null)
setUpdating(true) setUpdating(true)
await updateLineItem({ lineId: item.id, quantity })
.then(() => notifyCartUpdated())
.catch((err) => setError(err.message))
.finally(() => setUpdating(false))
}
await updateLineItem({ const remove = async () => {
lineId: item.id, setRemoving(true)
quantity, await deleteLineItem(item.id)
}) .then(() => notifyCartUpdated())
.catch((err) => { .catch((err) => {
setError(err.message) setError(err.message)
}) setRemoving(false)
.finally(() => {
setUpdating(false)
}) })
} }
const maxQtyFromInventory = 10
const maxQuantity = item.variant?.manage_inventory ? 10 : maxQtyFromInventory
return ( return (
<Table.Row className="w-full border-b border-border" data-testid="product-row"> <li
<Table.Cell className="p-3 w-20"> className={cn("flex gap-4 sm:gap-6", isFull ? "py-6" : "py-4", removing && "opacity-40")}
<LocalizedClientLink data-testid="product-row"
href={`/products/${item.product_handle}`} >
className={cn("flex rounded-md overflow-hidden border border-border", { <LocalizedClientLink
"w-14 h-14": type === "preview", href={`/products/${item.product_handle}`}
"sm:w-20 sm:h-20 w-14 h-14": type === "full", className={cn(
})} "relative aspect-[4/5] shrink-0 overflow-hidden rounded-lg bg-muted",
> isFull ? "w-24 sm:w-32" : "w-14"
<Thumbnail )}
thumbnail={item.thumbnail} >
images={item.variant?.product?.images} <Image
size="square" src={getProductCardImage(item.product_title)}
/> alt={item.product_title ?? ""}
</LocalizedClientLink> fill
</Table.Cell> sizes={isFull ? "128px" : "56px"}
className="object-cover"
/>
</LocalizedClientLink>
<Table.Cell className="text-left py-3"> <div className="flex min-w-0 flex-1 flex-col">
<LocalizedClientLink <div className="flex items-start justify-between gap-4">
href={`/products/${item.product_handle}`} <div className="min-w-0">
className="font-medium text-foreground hover:underline line-clamp-2 text-sm sm:text-base" <LocalizedClientLink
data-testid="product-title" href={`/products/${item.product_handle}`}
> className={cn(
{item.product_title} "text-foreground transition-colors hover:text-primary line-clamp-2",
</LocalizedClientLink> isFull ? "text-base" : "text-sm"
<LineItemOptions variant={item.variant} data-testid="product-variant" />
</Table.Cell>
{type === "full" && (
<Table.Cell className="py-3">
<div className="flex gap-2 items-center w-28">
<DeleteButton id={item.id} data-testid="product-delete-button" />
<CartItemSelect
value={item.quantity}
onChange={(value) => changeQuantity(parseInt(value.target.value))}
className="h-9 rounded-md border border-input bg-background px-2 text-sm"
data-testid="product-select-button"
>
{Array.from(
{
length: Math.min(maxQuantity, 10),
},
(_, i) => (
<option value={i + 1} key={i}>
{i + 1}
</option>
)
)} )}
</CartItemSelect> data-testid="product-title"
{updating && <Loader2 className="h-4 w-4 animate-spin text-muted-foreground" />} >
{item.product_title}
</LocalizedClientLink>
<LineItemOptions variant={item.variant} metadata={item.metadata} data-testid="product-variant" />
</div> </div>
<ErrorMessage error={error} data-testid="product-error-message" /> <div className="shrink-0 text-right">
</Table.Cell> <p className={cn("text-foreground tabular-nums", isFull ? "text-base" : "text-sm")} data-testid="product-price">
)} {money(item.total)}
</p>
{(isFull ? item.quantity > 1 : true) && (
<p className="mt-0.5 text-xs text-muted-foreground tabular-nums">
{item.quantity} × {money(item.unit_price)}
</p>
)}
</div>
</div>
{type === "full" && ( {isFull && (
<Table.Cell className="hidden sm:table-cell py-3 text-muted-foreground text-sm"> <div className="mt-auto flex items-center justify-between pt-4">
<LineItemUnitPrice <div className="inline-flex items-center rounded-full border border-border" data-testid="product-select-button">
item={item} <button
style="tight" type="button"
currencyCode={currencyCode} onClick={() => changeQuantity(item.quantity - 1)}
/> disabled={updating || item.quantity <= 1}
</Table.Cell> className="flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground disabled:opacity-30"
)} aria-label="Smanji količinu"
>
<Table.Cell className="text-right py-3 pr-4 font-semibold text-foreground text-sm"> <Minus className="h-3.5 w-3.5" />
<span </button>
className={cn({ <span className="w-8 text-center text-sm tabular-nums" aria-live="polite">
"flex flex-col items-end h-full justify-center": type === "preview", {updating ? <Loader2 className="mx-auto h-3.5 w-3.5 animate-spin text-primary" /> : item.quantity}
})} </span>
> <button
{type === "preview" && ( type="button"
<span className="flex gap-x-1 text-xs text-muted-foreground font-normal"> onClick={() => changeQuantity(item.quantity + 1)}
<span>{item.quantity}x </span> disabled={updating || item.quantity >= MAX_QUANTITY}
<LineItemUnitPrice className="flex h-9 w-9 items-center justify-center rounded-full text-muted-foreground transition-colors hover:text-foreground disabled:opacity-30"
item={item} aria-label="Povećaj količinu"
style="tight" >
currencyCode={currencyCode} <Plus className="h-3.5 w-3.5" />
/> </button>
</span> </div>
)} <button
<LineItemPrice type="button"
item={item} onClick={remove}
style="tight" disabled={removing || updating}
currencyCode={currencyCode} className="text-sm text-muted-foreground underline-offset-4 transition-colors hover:text-destructive hover:underline disabled:opacity-40"
/> data-testid="product-delete-button"
</span> >
</Table.Cell> Ukloni
</Table.Row> </button>
</div>
)}
<ErrorMessage error={error} data-testid="product-error-message" />
</div>
</li>
) )
} }

View File

@@ -1,24 +1,21 @@
import { Button } from "@/components/ui/button"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
const SignInPrompt = () => { const SignInPrompt = () => {
return ( return (
<div className="flex items-center justify-between rounded-xl border border-border bg-muted/30 p-4 sm:p-5"> <div className="flex flex-col sm:flex-row sm:items-center justify-between gap-4 rounded-xl border border-border/80 p-5 sm:p-6">
<div> <div>
<h3 className="text-base font-semibold text-foreground"> <p className="text-sm text-foreground">Već imate nalog?</p>
Već imate nalog? <p className="mt-1 text-xs text-muted-foreground">
</h3> Prijavite se za brže naručivanje i praćenje isporuke.
<p className="text-xs sm:text-sm text-muted-foreground mt-0.5">
Prijavite se za brže naručivanje i praćenje statusa isporuke.
</p> </p>
</div> </div>
<div> <LocalizedClientLink
<LocalizedClientLink href="/account"> href="/account"
<Button variant="outline" size="sm" data-testid="sign-in-button"> className="inline-flex h-10 shrink-0 items-center justify-center rounded-md border border-border px-5 text-sm text-foreground transition-colors hover:bg-muted"
Prijava data-testid="sign-in-button"
</Button> >
</LocalizedClientLink> Prijava
</div> </LocalizedClientLink>
</div> </div>
) )
} }

View File

@@ -2,7 +2,6 @@ import ItemsTemplate from "./items"
import Summary from "./summary" import Summary from "./summary"
import EmptyCartMessage from "../components/empty-cart-message" import EmptyCartMessage from "../components/empty-cart-message"
import SignInPrompt from "../components/sign-in-prompt" import SignInPrompt from "../components/sign-in-prompt"
import { Separator } from "@/components/ui/separator"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
const CartTemplate = ({ const CartTemplate = ({
@@ -12,34 +11,34 @@ const CartTemplate = ({
cart: HttpTypes.StoreCart | null cart: HttpTypes.StoreCart | null
customer: HttpTypes.StoreCustomer | null customer: HttpTypes.StoreCustomer | null
}) => { }) => {
const count = cart?.items?.reduce((sum, i) => sum + i.quantity, 0) ?? 0
return ( return (
<div className="py-8 sm:py-12"> <div className="content-container pb-20 sm:pb-28" data-testid="cart-container">
<div className="content-container" data-testid="cart-container"> {cart?.items?.length ? (
{cart?.items?.length ? ( <>
<div className="grid grid-cols-1 lg:grid-cols-12 gap-8 items-start"> <header className="pt-14 sm:pt-20 pb-10 sm:pb-14 text-center">
<div className="lg:col-span-8 flex flex-col gap-6"> <p className="eyebrow">Korpa</p>
{!customer && ( <h1 className="display-heading mt-5 text-4xl sm:text-6xl text-foreground">Vaša korpa</h1>
<> <p className="mt-4 text-sm text-muted-foreground">
<SignInPrompt /> {count % 10 === 1 && count % 100 !== 11 ? `${count} artikal` : `${count} artikala`} · Dostava za
<Separator /> 24–48h širom BiH ili preuzimanje u Gračanici
</> </p>
)} </header>
<div className="grid grid-cols-1 lg:grid-cols-12 gap-10 lg:gap-16 items-start">
<div className="lg:col-span-7 xl:col-span-8 flex flex-col gap-8">
<ItemsTemplate cart={cart} /> <ItemsTemplate cart={cart} />
{!customer && <SignInPrompt />}
</div> </div>
<div className="lg:col-span-4 sticky top-24"> <aside className="lg:col-span-5 xl:col-span-4 lg:sticky lg:top-28">
{cart && cart.region && ( {cart.region && <Summary cart={cart} />}
<div className="rounded-xl border border-border bg-card p-6 shadow-sm"> </aside>
<Summary cart={cart} />
</div>
)}
</div>
</div> </div>
) : ( </>
<div> ) : (
<EmptyCartMessage /> <EmptyCartMessage />
</div> )}
)}
</div>
</div> </div>
) )
} }

View File

@@ -1,56 +1,21 @@
import repeat from "@lib/util/repeat"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { Heading, Table } from "@modules/common/components/ui"
import Item from "@modules/cart/components/item" import Item from "@modules/cart/components/item"
import SkeletonLineItem from "@modules/skeletons/components/skeleton-line-item"
type ItemsTemplateProps = { type ItemsTemplateProps = {
cart?: HttpTypes.StoreCart cart?: HttpTypes.StoreCart
} }
const ItemsTemplate = ({ cart }: ItemsTemplateProps) => { const ItemsTemplate = ({ cart }: ItemsTemplateProps) => {
const items = cart?.items const items = [...(cart?.items ?? [])].sort((a, b) =>
(a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1
)
return ( return (
<div> <ul className="divide-y divide-border/70 border-y border-border/70" data-testid="items-table">
<div className="pb-3 flex items-center"> {items.map((item) => (
<Heading className="text-[2rem] leading-[2.75rem]">Cart</Heading> <Item key={item.id} item={item} currencyCode={cart?.currency_code ?? ""} />
</div> ))}
<Table> </ul>
<Table.Header className="border-t-0">
<Table.Row className="text-ui-fg-subtle txt-medium-plus">
<Table.HeaderCell className="!pl-0">Item</Table.HeaderCell>
<Table.HeaderCell></Table.HeaderCell>
<Table.HeaderCell>Quantity</Table.HeaderCell>
<Table.HeaderCell className="hidden small:table-cell">
Price
</Table.HeaderCell>
<Table.HeaderCell className="!pr-0 text-right">
Total
</Table.HeaderCell>
</Table.Row>
</Table.Header>
<Table.Body>
{items
? items
.sort((a, b) => {
return (a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1
})
.map((item) => {
return (
<Item
key={item.id}
item={item}
currencyCode={cart?.currency_code}
/>
)
})
: repeat(5).map((i) => {
return <SkeletonLineItem key={i} />
})}
</Table.Body>
</Table>
</div>
) )
} }

View File

@@ -1,50 +1,32 @@
"use client" "use client"
import repeat from "@lib/util/repeat"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { Table, clx } from "@modules/common/components/ui" import { cn } from "@/lib/utils"
import Item from "@modules/cart/components/item" import Item from "@modules/cart/components/item"
import SkeletonLineItem from "@modules/skeletons/components/skeleton-line-item"
type ItemsTemplateProps = { type ItemsTemplateProps = {
cart: HttpTypes.StoreCart cart: HttpTypes.StoreCart
} }
/** Compact item list for the checkout summary */
const ItemsPreviewTemplate = ({ cart }: ItemsTemplateProps) => { const ItemsPreviewTemplate = ({ cart }: ItemsTemplateProps) => {
const items = cart.items const items = [...(cart.items ?? [])].sort((a, b) =>
const hasOverflow = items && items.length > 4 (a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1
)
const hasOverflow = items.length > 4
return ( return (
<div <ul
className={clx({ className={cn(
"pl-[1px] overflow-y-scroll overflow-x-hidden no-scrollbar max-h-[420px]": "divide-y divide-border/70",
hasOverflow, hasOverflow && "max-h-[420px] overflow-y-auto no-scrollbar"
})} )}
data-testid="items-table"
> >
<Table> {items.map((item) => (
<Table.Body data-testid="items-table"> <Item key={item.id} item={item} type="preview" currencyCode={cart.currency_code} />
{items ))}
? items </ul>
.sort((a, b) => {
return (a.created_at ?? "") > (b.created_at ?? "") ? -1 : 1
})
.map((item) => {
return (
<Item
key={item.id}
item={item}
type="preview"
currencyCode={cart.currency_code}
/>
)
})
: repeat(5).map((i) => {
return <SkeletonLineItem key={i} />
})}
</Table.Body>
</Table>
</div>
) )
} }

View File

@@ -1,11 +1,10 @@
"use client" "use client"
import { Button } from "@/components/ui/button"
import CartTotals from "@modules/common/components/cart-totals" import CartTotals from "@modules/common/components/cart-totals"
import { Separator } from "@/components/ui/separator"
import DiscountCode from "@modules/checkout/components/discount-code" import DiscountCode from "@modules/checkout/components/discount-code"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import LocalizedClientLink from "@modules/common/components/localized-client-link"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { ArrowRight } from "lucide-react"
type SummaryProps = { type SummaryProps = {
cart: HttpTypes.StoreCart cart: HttpTypes.StoreCart
@@ -25,22 +24,22 @@ const Summary = ({ cart }: SummaryProps) => {
const step = getCheckoutStep(cart) const step = getCheckoutStep(cart)
return ( return (
<div className="flex flex-col gap-4"> <div className="rounded-2xl bg-muted p-6 sm:p-8">
<h2 className="text-xl font-bold tracking-tight text-foreground"> <p className="eyebrow text-muted-foreground">Pregled narudžbe</p>
Pregled Narudžbe <div className="mt-6">
</h2> <CartTotals totals={cart} />
<DiscountCode cart={cart} /> </div>
<Separator />
<CartTotals totals={cart} />
<LocalizedClientLink <LocalizedClientLink
href={"/checkout?step=" + step} href={"/checkout?step=" + step}
data-testid="checkout-button" data-testid="checkout-button"
className="w-full" className="mt-6 flex h-12 w-full items-center justify-center gap-2 rounded-md bg-primary text-sm text-primary-foreground transition-colors hover:bg-primary/90"
> >
<Button className="w-full h-11 text-base font-semibold"> Nastavite na plaćanje
Nastavi na plaćanje <ArrowRight className="h-4 w-4" />
</Button>
</LocalizedClientLink> </LocalizedClientLink>
<div className="mt-6 border-t border-border pt-6">
<DiscountCode cart={cart} />
</div>
</div> </div>
) )
} }

View File

@@ -0,0 +1,64 @@
"use client"
import { Search } from "lucide-react"
import { useParams, usePathname, useRouter } from "next/navigation"
import { useState } from "react"
import { PRODUCT_INDEX_NAME } from "@lib/search-client"
import RefinementList from "@modules/store/components/refinement-list"
import { SortOptions } from "@modules/store/components/refinement-list/sort-products"
import CatalogToolbar from "@modules/store/components/catalog-toolbar"
const SORT_LABELS: Record<SortOptions, string> = {
created_at: "Najnovije",
price_asc: "Cijena: od najniže",
price_desc: "Cijena: od najviše",
}
/** Category search hands the query to the full-catalog search on /store */
function CategorySearch({ onClose }: { onClose: () => void }) {
const router = useRouter()
const { countryCode } = useParams<{ countryCode: string }>()
const [value, setValue] = useState("")
return (
<form
role="search"
onSubmit={(event) => {
event.preventDefault()
const query = value.trim()
if (!query) return
const params = new URLSearchParams({ [`${PRODUCT_INDEX_NAME}[query]`]: query })
router.push(`/${countryCode}/store?${params.toString()}`)
}}
className="relative flex items-center"
>
<Search className="pointer-events-none absolute left-1 h-4 w-4 text-muted-foreground" />
<input
type="search"
autoFocus
value={value}
onChange={(e) => setValue(e.target.value)}
onKeyDown={(e) => e.key === "Escape" && onClose()}
placeholder="Pretražite sve proizvode i pritisnite Enter"
aria-label="Pretraži proizvode"
className="h-10 w-full bg-transparent pl-8 text-base sm:text-sm placeholder:text-muted-foreground focus-visible:outline-none [&::-webkit-search-cancel-button]:hidden"
/>
</form>
)
}
export default function CategoryToolbar({ sortBy }: { sortBy: SortOptions }) {
const router = useRouter()
const pathname = usePathname()
const isDefaultSort = sortBy === "created_at"
return (
<CatalogToolbar
summary={`Sortiranje: ${SORT_LABELS[sortBy] ?? SORT_LABELS.created_at}`}
filters={<RefinementList sortBy={sortBy} data-testid="sort-by-container" hideOptionsPicker />}
activeFilters={isDefaultSort ? 0 : 1}
onClearFilters={() => router.push(pathname)}
renderSearch={({ onClose }) => <CategorySearch onClose={onClose} />}
/>
)
}

View File

@@ -1,14 +1,12 @@
import { notFound } from "next/navigation" import { notFound } from "next/navigation"
import { Suspense } from "react" import { Suspense } from "react"
import SkeletonProductGrid from "@modules/skeletons/templates/skeleton-product-grid" import SkeletonProductGrid from "@modules/skeletons/templates/skeleton-product-grid"
import RefinementList from "@modules/store/components/refinement-list" import CategoryToolbar from "@modules/categories/components/category-toolbar"
import { SortOptions } from "@modules/store/components/refinement-list/sort-products" import { SortOptions } from "@modules/store/components/refinement-list/sort-products"
import PaginatedProducts from "@modules/store/templates/paginated-products" import PaginatedProducts from "@modules/store/templates/paginated-products"
import LocalizedClientLink from "@modules/common/components/localized-client-link" import CatalogHeader from "@modules/store/components/catalog-header"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
import { OptionValueIds } from "@lib/util/product-option-filters" import { OptionValueIds } from "@lib/util/product-option-filters"
import { ChevronRight } from "lucide-react"
import { Badge } from "@/components/ui/badge"
export default function CategoryTemplate({ export default function CategoryTemplate({
category, category,
@@ -28,101 +26,35 @@ export default function CategoryTemplate({
if (!category || !countryCode) notFound() if (!category || !countryCode) notFound()
const parents = [] as HttpTypes.StoreProductCategory[] const rootHandle =
category.parent_category?.handle ?? category.handle ?? null
const getParents = (category: HttpTypes.StoreProductCategory) => {
if (category.parent_category) {
parents.push(category.parent_category)
getParents(category.parent_category)
}
}
getParents(category)
return ( return (
<div <div className="content-container pb-20 sm:pb-28" data-testid="category-container">
className="content-container py-8 sm:py-12" <CatalogHeader
data-testid="category-container" kicker="Katalog"
> title={category.name}
{/* Breadcrumb Navigation */} description={category.description}
<nav className="flex items-center gap-2 text-xs text-muted-foreground mb-4"> activeHandle={rootHandle}
<LocalizedClientLink href="/" className="hover:text-foreground"> titleTestId="category-page-title"
Početna />
</LocalizedClientLink>
<ChevronRight className="h-3 w-3" />
<LocalizedClientLink href="/store" className="hover:text-foreground">
Katalog
</LocalizedClientLink>
{parents.reverse().map((parent) => (
<span key={parent.id} className="flex items-center gap-2">
<ChevronRight className="h-3 w-3" />
<LocalizedClientLink
href={`/categories/${parent.handle}`}
className="hover:text-foreground"
>
{parent.name}
</LocalizedClientLink>
</span>
))}
<ChevronRight className="h-3 w-3" />
<span className="text-foreground font-medium">{category.name}</span>
</nav>
{/* Category Header */} <CategoryToolbar sortBy={sort} />
<div className="mb-8 border-b border-border pb-6"> <Suspense
<h1 fallback={
className="text-3xl sm:text-4xl font-extrabold tracking-tight text-foreground" <SkeletonProductGrid
data-testid="category-page-title" numberOfProducts={category.products?.length ?? 8}
> />
{category.name} }
</h1> >
{category.description && ( <PaginatedProducts
<p className="mt-2 text-base text-muted-foreground max-w-3xl leading-relaxed"> sortBy={sort}
{category.description} page={pageNumber}
</p> categoryId={category.id}
)} countryCode={countryCode}
{category.category_children && category.category_children.length > 0 && ( optionValueIds={optionValueIds}
<div className="mt-4 flex flex-wrap gap-2"> />
{category.category_children.map((c) => ( </Suspense>
<LocalizedClientLink key={c.id} href={`/categories/${c.handle}`}>
<Badge variant="outline" className="px-3 py-1 hover:bg-accent transition-colors">
{c.name}
</Badge>
</LocalizedClientLink>
))}
</div>
)}
</div>
{/* Main Grid: Sidebar + Products */}
<div className="grid grid-cols-1 lg:grid-cols-4 gap-8">
<div className="lg:col-span-1">
<div className="rounded-xl border border-border bg-card p-4 sm:p-5 shadow-sm sticky top-24">
<RefinementList
sortBy={sort}
data-testid="sort-by-container"
hideOptionsPicker
/>
</div>
</div>
<div className="lg:col-span-3">
<Suspense
fallback={
<SkeletonProductGrid
numberOfProducts={category.products?.length ?? 8}
/>
}
>
<PaginatedProducts
sortBy={sort}
page={pageNumber}
categoryId={category.id}
countryCode={countryCode}
optionValueIds={optionValueIds}
/>
</Suspense>
</div>
</div>
</div> </div>
) )
} }

View File

@@ -36,7 +36,7 @@ const AddressSelect = ({
<Listbox onChange={handleSelect} value={selectedAddress?.id}> <Listbox onChange={handleSelect} value={selectedAddress?.id}>
<div className="relative"> <div className="relative">
<Listbox.Button <Listbox.Button
className="relative w-full flex justify-between items-center px-4 py-[10px] text-left bg-white cursor-default focus:outline-none border rounded-rounded focus-visible:ring-2 focus-visible:ring-opacity-75 focus-visible:ring-white focus-visible:ring-offset-gray-300 focus-visible:ring-offset-2 focus-visible:border-gray-300 text-base-regular" className="relative w-full flex justify-between items-center px-4 py-[10px] text-left bg-white cursor-default focus:outline-none border rounded-rounded focus-visible:ring-2 focus-visible:ring-opacity-75 focus-visible:ring-white focus-visible:ring-offset-gray-300 focus-visible:ring-offset-2 focus-visible:border-gray-300 text-base"
data-testid="shipping-address-select" data-testid="shipping-address-select"
> >
{({ open }) => ( {({ open }) => (
@@ -44,7 +44,7 @@ const AddressSelect = ({
<span className="block truncate"> <span className="block truncate">
{selectedAddress {selectedAddress
? selectedAddress.address_1 ? selectedAddress.address_1
: "Choose an address"} : "Odaberite adresu"}
</span> </span>
<ChevronsUpDown <ChevronsUpDown
className={clx("h-4 w-4 transition-transform duration-200", { className={clx("h-4 w-4 transition-transform duration-200", {
@@ -61,7 +61,7 @@ const AddressSelect = ({
leaveTo="opacity-0" leaveTo="opacity-0"
> >
<Listbox.Options <Listbox.Options
className="absolute z-20 w-full overflow-auto text-small-regular bg-white border border-top-0 max-h-60 focus:outline-none sm:text-sm" className="absolute z-20 w-full overflow-auto text-sm bg-white border border-top-0 max-h-60 focus:outline-none sm:text-sm"
data-testid="shipping-address-options" data-testid="shipping-address-options"
> >
{addresses.map((address) => { {addresses.map((address) => {
@@ -78,15 +78,15 @@ const AddressSelect = ({
data-testid="shipping-address-radio" data-testid="shipping-address-radio"
/> />
<div className="flex flex-col"> <div className="flex flex-col">
<span className="text-left text-base-semi"> <span className="text-left text-base font-semibold">
{address.first_name} {address.last_name} {address.first_name} {address.last_name}
</span> </span>
{address.company && ( {address.company && (
<span className="text-small-regular text-ui-fg-base"> <span className="text-sm text-foreground">
{address.company} {address.company}
</span> </span>
)} )}
<div className="flex flex-col text-left text-base-regular mt-2"> <div className="flex flex-col text-left text-base mt-2">
<span> <span>
{address.address_1} {address.address_1}
{address.address_2 && ( {address.address_2 && (

View File

@@ -44,19 +44,19 @@ const Addresses = ({
<div className="flex flex-row items-center justify-between mb-6"> <div className="flex flex-row items-center justify-between mb-6">
<Heading <Heading
level="h2" level="h2"
className="flex flex-row text-3xl-regular gap-x-2 items-baseline" className="flex flex-row font-display text-3xl gap-x-2 items-baseline"
> >
Shipping Address Adresa dostave
{!isOpen && <CheckCircleSolid />} {!isOpen && <CheckCircleSolid />}
</Heading> </Heading>
{!isOpen && cart?.shipping_address && ( {!isOpen && cart?.shipping_address && (
<Text> <Text>
<button <button
onClick={handleEdit} onClick={handleEdit}
className="text-ui-fg-interactive hover:text-ui-fg-interactive-hover" className="text-primary hover:text-primary/80"
data-testid="edit-address-button" data-testid="edit-address-button"
> >
Edit Izmijeni
</button> </button>
</Text> </Text>
)} )}
@@ -75,23 +75,23 @@ const Addresses = ({
<div> <div>
<Heading <Heading
level="h2" level="h2"
className="text-3xl-regular gap-x-4 pb-6 pt-8" className="font-display text-3xl gap-x-4 pb-6 pt-8"
> >
Billing address Adresa za račun
</Heading> </Heading>
<BillingAddress cart={cart} /> <BillingAddress cart={cart} />
</div> </div>
)} )}
<SubmitButton className="mt-6" data-testid="submit-address-button"> <SubmitButton className="mt-6" data-testid="submit-address-button">
Continue to delivery Nastavite na dostavu
</SubmitButton> </SubmitButton>
<ErrorMessage error={message} data-testid="address-error-message" /> <ErrorMessage error={message} data-testid="address-error-message" />
</div> </div>
</form> </form>
) : ( ) : (
<div> <div>
<div className="text-small-regular"> <div className="text-sm">
{cart && cart.shipping_address ? ( {cart && cart.shipping_address ? (
<div className="flex items-start gap-x-8"> <div className="flex items-start gap-x-8">
<div className="flex items-start gap-x-1 w-full"> <div className="flex items-start gap-x-1 w-full">
@@ -99,22 +99,22 @@ const Addresses = ({
className="flex flex-col w-1/3" className="flex flex-col w-1/3"
data-testid="shipping-address-summary" data-testid="shipping-address-summary"
> >
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Shipping Address Adresa dostave
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_address.first_name}{" "} {cart.shipping_address.first_name}{" "}
{cart.shipping_address.last_name} {cart.shipping_address.last_name}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_address.address_1}{" "} {cart.shipping_address.address_1}{" "}
{cart.shipping_address.address_2} {cart.shipping_address.address_2}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_address.postal_code},{" "} {cart.shipping_address.postal_code},{" "}
{cart.shipping_address.city} {cart.shipping_address.city}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_address.country_code?.toUpperCase()} {cart.shipping_address.country_code?.toUpperCase()}
</Text> </Text>
</div> </div>
@@ -123,13 +123,13 @@ const Addresses = ({
className="flex flex-col w-1/3 " className="flex flex-col w-1/3 "
data-testid="shipping-contact-summary" data-testid="shipping-contact-summary"
> >
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Contact Kontakt
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_address.phone} {cart.shipping_address.phone}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.email} {cart.email}
</Text> </Text>
</div> </div>
@@ -138,29 +138,29 @@ const Addresses = ({
className="flex flex-col w-1/3" className="flex flex-col w-1/3"
data-testid="billing-address-summary" data-testid="billing-address-summary"
> >
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Billing Address Adresa za račun
</Text> </Text>
{sameAsBilling ? ( {sameAsBilling ? (
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
Billing and delivery address are the same. Adresa za račun ista je kao adresa dostave.
</Text> </Text>
) : ( ) : (
<> <>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.billing_address?.first_name}{" "} {cart.billing_address?.first_name}{" "}
{cart.billing_address?.last_name} {cart.billing_address?.last_name}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.billing_address?.address_1}{" "} {cart.billing_address?.address_1}{" "}
{cart.billing_address?.address_2} {cart.billing_address?.address_2}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.billing_address?.postal_code},{" "} {cart.billing_address?.postal_code},{" "}
{cart.billing_address?.city} {cart.billing_address?.city}
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.billing_address?.country_code?.toUpperCase()} {cart.billing_address?.country_code?.toUpperCase()}
</Text> </Text>
</> </>

View File

@@ -31,7 +31,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
<> <>
<div className="grid grid-cols-2 gap-4"> <div className="grid grid-cols-2 gap-4">
<Input <Input
label="First name" label="Ime"
name="billing_address.first_name" name="billing_address.first_name"
autoComplete="given-name" autoComplete="given-name"
value={formData["billing_address.first_name"]} value={formData["billing_address.first_name"]}
@@ -40,7 +40,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-first-name-input" data-testid="billing-first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="billing_address.last_name" name="billing_address.last_name"
autoComplete="family-name" autoComplete="family-name"
value={formData["billing_address.last_name"]} value={formData["billing_address.last_name"]}
@@ -49,7 +49,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-last-name-input" data-testid="billing-last-name-input"
/> />
<Input <Input
label="Address" label="Adresa"
name="billing_address.address_1" name="billing_address.address_1"
autoComplete="address-line1" autoComplete="address-line1"
value={formData["billing_address.address_1"]} value={formData["billing_address.address_1"]}
@@ -58,7 +58,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-address-input" data-testid="billing-address-input"
/> />
<Input <Input
label="Company" label="Firma"
name="billing_address.company" name="billing_address.company"
value={formData["billing_address.company"]} value={formData["billing_address.company"]}
onChange={handleChange} onChange={handleChange}
@@ -66,7 +66,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-company-input" data-testid="billing-company-input"
/> />
<Input <Input
label="Postal code" label="Poštanski broj"
name="billing_address.postal_code" name="billing_address.postal_code"
autoComplete="postal-code" autoComplete="postal-code"
value={formData["billing_address.postal_code"]} value={formData["billing_address.postal_code"]}
@@ -75,7 +75,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-postal-input" data-testid="billing-postal-input"
/> />
<Input <Input
label="City" label="Grad"
name="billing_address.city" name="billing_address.city"
autoComplete="address-level2" autoComplete="address-level2"
value={formData["billing_address.city"]} value={formData["billing_address.city"]}
@@ -91,7 +91,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-country-select" data-testid="billing-country-select"
/> />
<Input <Input
label="State / Province" label="Kanton / entitet"
name="billing_address.province" name="billing_address.province"
autoComplete="address-level1" autoComplete="address-level1"
value={formData["billing_address.province"]} value={formData["billing_address.province"]}
@@ -99,7 +99,7 @@ const BillingAddress = ({ cart }: { cart: HttpTypes.StoreCart | null }) => {
data-testid="billing-province-input" data-testid="billing-province-input"
/> />
<Input <Input
label="Phone" label="Telefon"
name="billing_address.phone" name="billing_address.phone"
autoComplete="tel" autoComplete="tel"
value={formData["billing_address.phone"]} value={formData["billing_address.phone"]}

View File

@@ -10,7 +10,7 @@ const CountrySelect = forwardRef<
NativeSelectProps & { NativeSelectProps & {
region?: HttpTypes.StoreRegion region?: HttpTypes.StoreRegion
} }
>(({ placeholder = "Country", region, defaultValue, ...props }, ref) => { >(({ placeholder = "Država", region, defaultValue, ...props }, ref) => {
const innerRef = useRef<HTMLSelectElement>(null) const innerRef = useRef<HTMLSelectElement>(null)
useImperativeHandle<HTMLSelectElement | null, HTMLSelectElement | null>( useImperativeHandle<HTMLSelectElement | null, HTMLSelectElement | null>(

View File

@@ -130,7 +130,7 @@ const AdyenPaymentButton = ({
} }
mount().catch(() => { mount().catch(() => {
setErrorMessage("Could not load the payment methods.") setErrorMessage("Načini plaćanja se nisu mogli učitati.")
}) })
return () => { return () => {
@@ -144,7 +144,7 @@ const AdyenPaymentButton = ({
if (notReady) { if (notReady) {
return ( return (
<Button disabled size="large" data-testid={dataTestId}> <Button disabled size="large" data-testid={dataTestId}>
Place order Potvrdi narudžbu
</Button> </Button>
) )
} }

View File

@@ -51,7 +51,7 @@ const PaymentButton: React.FC<PaymentButtonProps> = ({
<ManualTestPaymentButton notReady={notReady} data-testid={dataTestId} /> <ManualTestPaymentButton notReady={notReady} data-testid={dataTestId} />
) )
default: default:
return <Button disabled>Select a payment method</Button> return <Button disabled>Odaberite način plaćanja</Button>
} }
} }
@@ -160,7 +160,7 @@ const StripePaymentButton = ({
isLoading={submitting} isLoading={submitting}
data-testid={dataTestId} data-testid={dataTestId}
> >
Place order Potvrdi narudžbu
</Button> </Button>
<ErrorMessage <ErrorMessage
error={errorMessage} error={errorMessage}
@@ -199,7 +199,7 @@ const ManualTestPaymentButton = ({ notReady }: { notReady: boolean }) => {
size="large" size="large"
data-testid="submit-order-button" data-testid="submit-order-button"
> >
Place order Potvrdi narudžbu
</Button> </Button>
<ErrorMessage <ErrorMessage
error={errorMessage} error={errorMessage}

View File

@@ -33,9 +33,9 @@ const PaymentContainer: React.FC<PaymentContainerProps> = ({
value={paymentProviderId} value={paymentProviderId}
disabled={disabled} disabled={disabled}
className={clx( className={clx(
"flex flex-col gap-y-2 text-small-regular cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:shadow-borders-interactive-with-active", "flex flex-col gap-y-2 text-sm cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:border-primary",
{ {
"border-ui-border-interactive": "border-primary":
selectedPaymentOptionId === paymentProviderId, selectedPaymentOptionId === paymentProviderId,
} }
)} )}
@@ -43,19 +43,19 @@ const PaymentContainer: React.FC<PaymentContainerProps> = ({
<div className="flex items-center justify-between "> <div className="flex items-center justify-between ">
<div className="flex items-center gap-x-4"> <div className="flex items-center gap-x-4">
<Radio checked={selectedPaymentOptionId === paymentProviderId} /> <Radio checked={selectedPaymentOptionId === paymentProviderId} />
<Text className="text-base-regular"> <Text className="text-base">
{paymentInfo?.title || paymentProviderId} {paymentInfo?.title || paymentProviderId}
</Text> </Text>
{isManual(paymentProviderId) && isDevelopment && ( {isManual(paymentProviderId) && isDevelopment && (
<PaymentTest className="hidden small:block" /> <PaymentTest className="hidden lg:block" />
)} )}
</div> </div>
<span className="justify-self-end text-ui-fg-base"> <span className="justify-self-end text-foreground">
{paymentInfo?.icon} {paymentInfo?.icon}
</span> </span>
</div> </div>
{isManual(paymentProviderId) && isDevelopment && ( {isManual(paymentProviderId) && isDevelopment && (
<PaymentTest className="small:hidden text-[10px]" /> <PaymentTest className="lg:hidden text-[10px]" />
)} )}
{children} {children}
</RadioGroupOption> </RadioGroupOption>
@@ -85,8 +85,8 @@ export const StripePaymentContainer = ({
{selectedPaymentOptionId === paymentProviderId && {selectedPaymentOptionId === paymentProviderId &&
(stripeReady ? ( (stripeReady ? (
<div className="my-4 transition-all duration-150 ease-in-out"> <div className="my-4 transition-all duration-150 ease-in-out">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Enter your payment details: Unesite podatke za plaćanje:
</Text> </Text>
<PaymentElement <PaymentElement
options={{ layout: "accordion" }} options={{ layout: "accordion" }}
@@ -102,7 +102,7 @@ export const StripePaymentContainer = ({
setPaymentComplete(false) setPaymentComplete(false)
setError( setError(
getPaymentErrorMessage(e.error) ?? getPaymentErrorMessage(e.error) ??
"Could not load the payment methods." "Načini plaćanja se nisu mogli učitati."
) )
}} }}
/> />

View File

@@ -3,7 +3,7 @@ import { Badge } from "@modules/common/components/ui"
const PaymentTest = ({ className }: { className?: string }) => { const PaymentTest = ({ className }: { className?: string }) => {
return ( return (
<Badge color="orange" className={className}> <Badge color="orange" className={className}>
<span className="font-semibold">Attention:</span> For testing purposes <span className="font-semibold">Pažnja:</span> For testing purposes
only. only.
</Badge> </Badge>
) )

View File

@@ -116,24 +116,24 @@ const Payment = ({
<Heading <Heading
level="h2" level="h2"
className={clx( className={clx(
"flex flex-row text-3xl-regular gap-x-2 items-baseline", "flex flex-row font-display text-3xl gap-x-2 items-baseline",
{ {
"opacity-50 pointer-events-none select-none": "opacity-50 pointer-events-none select-none":
!isOpen && !paymentReady, !isOpen && !paymentReady,
} }
)} )}
> >
Payment Plaćanje
{!isOpen && paymentReady && <CheckCircleSolid />} {!isOpen && paymentReady && <CheckCircleSolid />}
</Heading> </Heading>
{!isOpen && paymentReady && ( {!isOpen && paymentReady && (
<Text> <Text>
<button <button
onClick={handleEdit} onClick={handleEdit}
className="text-ui-fg-interactive hover:text-ui-fg-interactive-hover" className="text-primary hover:text-primary/80"
data-testid="edit-payment-button" data-testid="edit-payment-button"
> >
Edit Izmijeni
</button> </button>
</Text> </Text>
)} )}
@@ -169,14 +169,14 @@ const Payment = ({
{paidByGiftcard && ( {paidByGiftcard && (
<div className="flex flex-col w-1/3"> <div className="flex flex-col w-1/3">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Payment method Način plaćanja
</Text> </Text>
<Text <Text
className="txt-medium text-ui-fg-subtle" className="text-sm text-muted-foreground"
data-testid="payment-method-summary" data-testid="payment-method-summary"
> >
Gift card Poklon kartica
</Text> </Text>
</div> </div>
)} )}
@@ -198,8 +198,8 @@ const Payment = ({
data-testid="submit-payment-button" data-testid="submit-payment-button"
> >
{!activeSession && isStripeLike(selectedPaymentMethod) {!activeSession && isStripeLike(selectedPaymentMethod)
? "Enter payment details" ? "Unesite podatke za plaćanje"
: "Continue to review"} : "Nastavite na pregled"}
</Button> </Button>
</div> </div>
@@ -207,11 +207,11 @@ const Payment = ({
{cart && paymentReady && activeSession ? ( {cart && paymentReady && activeSession ? (
<div className="flex items-start gap-x-1 w-full"> <div className="flex items-start gap-x-1 w-full">
<div className="flex flex-col w-1/3"> <div className="flex flex-col w-1/3">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Payment method Način plaćanja
</Text> </Text>
<Text <Text
className="txt-medium text-ui-fg-subtle" className="text-sm text-muted-foreground"
data-testid="payment-method-summary" data-testid="payment-method-summary"
> >
{getPaymentInfo(activeSession?.provider_id)?.title || {getPaymentInfo(activeSession?.provider_id)?.title ||
@@ -219,14 +219,14 @@ const Payment = ({
</Text> </Text>
</div> </div>
<div className="flex flex-col w-1/3"> <div className="flex flex-col w-1/3">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Payment details Podaci o plaćanju
</Text> </Text>
<div <div
className="flex gap-2 txt-medium text-ui-fg-subtle items-center" className="flex gap-2 text-sm text-muted-foreground items-center"
data-testid="payment-details-summary" data-testid="payment-details-summary"
> >
<Container className="flex items-center h-7 w-fit p-2 bg-ui-button-neutral-hover"> <Container className="flex items-center h-7 w-fit p-2 bg-muted">
{getPaymentInfo(selectedPaymentMethod)?.icon || ( {getPaymentInfo(selectedPaymentMethod)?.icon || (
<CreditCard /> <CreditCard />
)} )}
@@ -237,14 +237,14 @@ const Payment = ({
</div> </div>
) : paidByGiftcard ? ( ) : paidByGiftcard ? (
<div className="flex flex-col w-1/3"> <div className="flex flex-col w-1/3">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Payment method Način plaćanja
</Text> </Text>
<Text <Text
className="txt-medium text-ui-fg-subtle" className="text-sm text-muted-foreground"
data-testid="payment-method-summary" data-testid="payment-method-summary"
> >
Gift card Poklon kartica
</Text> </Text>
</div> </div>
) : null} ) : null}

View File

@@ -26,24 +26,23 @@ const Review = ({ cart }: { cart: HttpTypes.StoreCart }) => {
<Heading <Heading
level="h2" level="h2"
className={clx( className={clx(
"flex flex-row text-3xl-regular gap-x-2 items-baseline", "flex flex-row font-display text-3xl gap-x-2 items-baseline",
{ {
"opacity-50 pointer-events-none select-none": !isOpen, "opacity-50 pointer-events-none select-none": !isOpen,
} }
)} )}
> >
Review Pregled
</Heading> </Heading>
</div> </div>
{isOpen && previousStepsCompleted && ( {isOpen && previousStepsCompleted && (
<> <>
<div className="flex items-start gap-x-1 w-full mb-6"> <div className="flex items-start gap-x-1 w-full mb-6">
<div className="w-full"> <div className="w-full">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
By clicking the Place Order button, you confirm that you have Klikom na „Potvrdi narudžbu“ potvrđujete da ste pročitali i
read, understand and accept our Terms of Use, Terms of Sale and prihvatate uslove poslovanja i pravila o povratu robe, te da ste
Returns Policy and acknowledge that you have read Medusa upoznati s politikom privatnosti Suman d.o.o.
Store&apos;s Privacy Policy.
</Text> </Text>
</div> </div>
</div> </div>

View File

@@ -108,7 +108,7 @@ const ShippingAddress = ({
<> <>
{customer && (addressesInRegion?.length || 0) > 0 && ( {customer && (addressesInRegion?.length || 0) > 0 && (
<Container className="mb-6 flex flex-col gap-y-4 p-5"> <Container className="mb-6 flex flex-col gap-y-4 p-5">
<p className="text-small-regular"> <p className="text-sm">
{`Hi ${customer.first_name}, do you want to use one of your saved addresses?`} {`Hi ${customer.first_name}, do you want to use one of your saved addresses?`}
</p> </p>
<AddressSelect <AddressSelect
@@ -124,7 +124,7 @@ const ShippingAddress = ({
)} )}
<div className="grid grid-cols-2 gap-4"> <div className="grid grid-cols-2 gap-4">
<Input <Input
label="First name" label="Ime"
name="shipping_address.first_name" name="shipping_address.first_name"
autoComplete="given-name" autoComplete="given-name"
value={formData["shipping_address.first_name"]} value={formData["shipping_address.first_name"]}
@@ -133,7 +133,7 @@ const ShippingAddress = ({
data-testid="shipping-first-name-input" data-testid="shipping-first-name-input"
/> />
<Input <Input
label="Last name" label="Prezime"
name="shipping_address.last_name" name="shipping_address.last_name"
autoComplete="family-name" autoComplete="family-name"
value={formData["shipping_address.last_name"]} value={formData["shipping_address.last_name"]}
@@ -142,7 +142,7 @@ const ShippingAddress = ({
data-testid="shipping-last-name-input" data-testid="shipping-last-name-input"
/> />
<Input <Input
label="Address" label="Adresa"
name="shipping_address.address_1" name="shipping_address.address_1"
autoComplete="address-line1" autoComplete="address-line1"
value={formData["shipping_address.address_1"]} value={formData["shipping_address.address_1"]}
@@ -151,7 +151,7 @@ const ShippingAddress = ({
data-testid="shipping-address-input" data-testid="shipping-address-input"
/> />
<Input <Input
label="Company" label="Firma"
name="shipping_address.company" name="shipping_address.company"
value={formData["shipping_address.company"]} value={formData["shipping_address.company"]}
onChange={handleChange} onChange={handleChange}
@@ -186,7 +186,7 @@ const ShippingAddress = ({
)} )}
</div> </div>
<Input <Input
label="Postal code" label="Poštanski broj"
name="shipping_address.postal_code" name="shipping_address.postal_code"
autoComplete="postal-code" autoComplete="postal-code"
value={formData["shipping_address.postal_code"]} value={formData["shipping_address.postal_code"]}
@@ -195,7 +195,7 @@ const ShippingAddress = ({
data-testid="shipping-postal-code-input" data-testid="shipping-postal-code-input"
/> />
<Input <Input
label="City" label="Grad"
name="shipping_address.city" name="shipping_address.city"
autoComplete="address-level2" autoComplete="address-level2"
value={formData["shipping_address.city"]} value={formData["shipping_address.city"]}
@@ -213,7 +213,7 @@ const ShippingAddress = ({
data-testid="shipping-country-select" data-testid="shipping-country-select"
/> />
<Input <Input
label="State / Province" label="Kanton / entitet"
name="shipping_address.province" name="shipping_address.province"
autoComplete="address-level1" autoComplete="address-level1"
value={formData["shipping_address.province"]} value={formData["shipping_address.province"]}
@@ -223,7 +223,7 @@ const ShippingAddress = ({
</div> </div>
<div className="my-8"> <div className="my-8">
<Checkbox <Checkbox
label="Billing address same as shipping address" label="Adresa za račun ista je kao adresa dostave"
name="same_as_billing" name="same_as_billing"
checked={checked} checked={checked}
onChange={onChange} onChange={onChange}
@@ -235,7 +235,7 @@ const ShippingAddress = ({
label="Email" label="Email"
name="email" name="email"
type="email" type="email"
title="Enter a valid email address." title="Unesite ispravnu email adresu."
autoComplete="email" autoComplete="email"
value={formData.email} value={formData.email}
onChange={handleChange} onChange={handleChange}
@@ -243,7 +243,7 @@ const ShippingAddress = ({
data-testid="shipping-email-input" data-testid="shipping-email-input"
/> />
<Input <Input
label="Phone" label="Telefon"
name="shipping_address.phone" name="shipping_address.phone"
autoComplete="tel" autoComplete="tel"
value={formData["shipping_address.phone"]} value={formData["shipping_address.phone"]}

View File

@@ -157,14 +157,14 @@ const Shipping: React.FC<ShippingProps> = ({
<Heading <Heading
level="h2" level="h2"
className={clx( className={clx(
"flex flex-row text-3xl-regular gap-x-2 items-baseline", "flex flex-row font-display text-3xl gap-x-2 items-baseline",
{ {
"opacity-50 pointer-events-none select-none": "opacity-50 pointer-events-none select-none":
!isOpen && cart.shipping_methods?.length === 0, !isOpen && cart.shipping_methods?.length === 0,
} }
)} )}
> >
Delivery Dostava
{!isOpen && (cart.shipping_methods?.length ?? 0) > 0 && ( {!isOpen && (cart.shipping_methods?.length ?? 0) > 0 && (
<CheckCircleSolid /> <CheckCircleSolid />
)} )}
@@ -176,10 +176,10 @@ const Shipping: React.FC<ShippingProps> = ({
<Text> <Text>
<button <button
onClick={handleEdit} onClick={handleEdit}
className="text-ui-fg-interactive hover:text-ui-fg-interactive-hover" className="text-primary hover:text-primary/80"
data-testid="edit-delivery-button" data-testid="edit-delivery-button"
> >
Edit Izmijeni
</button> </button>
</Text> </Text>
)} )}
@@ -188,11 +188,11 @@ const Shipping: React.FC<ShippingProps> = ({
<> <>
<div className="grid"> <div className="grid">
<div className="flex flex-col"> <div className="flex flex-col">
<span className="font-medium txt-medium text-ui-fg-base"> <span className="font-medium text-sm text-foreground">
Shipping method Način dostave
</span> </span>
<span className="mb-4 text-ui-fg-muted txt-medium"> <span className="mb-4 text-muted-foreground text-sm">
How would you like you order delivered Kako želite da vam isporučimo narudžbu
</span> </span>
</div> </div>
<div data-testid="delivery-options-container"> <div data-testid="delivery-options-container">
@@ -214,9 +214,9 @@ const Shipping: React.FC<ShippingProps> = ({
value={PICKUP_OPTION_ON} value={PICKUP_OPTION_ON}
data-testid="delivery-option-radio" data-testid="delivery-option-radio"
className={clx( className={clx(
"flex items-center justify-between text-small-regular cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:shadow-borders-interactive-with-active", "flex items-center justify-between text-sm cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:border-primary",
{ {
"border-ui-border-interactive": "border-primary":
showPickupOptions === PICKUP_OPTION_ON, showPickupOptions === PICKUP_OPTION_ON,
} }
)} )}
@@ -225,11 +225,11 @@ const Shipping: React.FC<ShippingProps> = ({
<MedusaRadio <MedusaRadio
checked={showPickupOptions === PICKUP_OPTION_ON} checked={showPickupOptions === PICKUP_OPTION_ON}
/> />
<span className="text-base-regular"> <span className="text-base">
Pick up your order Preuzmite narudžbu lično
</span> </span>
</div> </div>
<span className="justify-self-end text-ui-fg-base"> <span className="justify-self-end text-foreground">
- -
</span> </span>
</Radio> </Radio>
@@ -256,9 +256,9 @@ const Shipping: React.FC<ShippingProps> = ({
data-testid="delivery-option-radio" data-testid="delivery-option-radio"
disabled={isDisabled} disabled={isDisabled}
className={clx( className={clx(
"flex items-center justify-between text-small-regular cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:shadow-borders-interactive-with-active", "flex items-center justify-between text-sm cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:border-primary",
{ {
"border-ui-border-interactive": "border-primary":
option.id === shippingMethodId, option.id === shippingMethodId,
"hover:shadow-brders-none cursor-not-allowed": "hover:shadow-brders-none cursor-not-allowed":
isDisabled, isDisabled,
@@ -269,11 +269,11 @@ const Shipping: React.FC<ShippingProps> = ({
<MedusaRadio <MedusaRadio
checked={option.id === shippingMethodId} checked={option.id === shippingMethodId}
/> />
<span className="text-base-regular"> <span className="text-base">
{option.name} {option.name}
</span> </span>
</div> </div>
<span className="justify-self-end text-ui-fg-base"> <span className="justify-self-end text-foreground">
{option.price_type === "flat" ? ( {option.price_type === "flat" ? (
convertToLocale({ convertToLocale({
amount: option.amount!, amount: option.amount!,
@@ -301,11 +301,11 @@ const Shipping: React.FC<ShippingProps> = ({
{showPickupOptions === PICKUP_OPTION_ON && ( {showPickupOptions === PICKUP_OPTION_ON && (
<div className="grid"> <div className="grid">
<div className="flex flex-col"> <div className="flex flex-col">
<span className="font-medium txt-medium text-ui-fg-base"> <span className="font-medium text-sm text-foreground">
Store Prodajno mjesto
</span> </span>
<span className="mb-4 text-ui-fg-muted txt-medium"> <span className="mb-4 text-muted-foreground text-sm">
Choose a store near you Odaberite najbliže prodajno mjesto
</span> </span>
</div> </div>
<div data-testid="delivery-options-container"> <div data-testid="delivery-options-container">
@@ -326,9 +326,9 @@ const Shipping: React.FC<ShippingProps> = ({
disabled={option.insufficient_inventory} disabled={option.insufficient_inventory}
data-testid="delivery-option-radio" data-testid="delivery-option-radio"
className={clx( className={clx(
"flex items-center justify-between text-small-regular cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:shadow-borders-interactive-with-active", "flex items-center justify-between text-sm cursor-pointer py-4 border rounded-rounded px-8 mb-2 hover:border-primary",
{ {
"border-ui-border-interactive": "border-primary":
option.id === shippingMethodId, option.id === shippingMethodId,
"hover:shadow-brders-none cursor-not-allowed": "hover:shadow-brders-none cursor-not-allowed":
option.insufficient_inventory, option.insufficient_inventory,
@@ -340,10 +340,10 @@ const Shipping: React.FC<ShippingProps> = ({
checked={option.id === shippingMethodId} checked={option.id === shippingMethodId}
/> />
<div className="flex flex-col"> <div className="flex flex-col">
<span className="text-base-regular"> <span className="text-base">
{option.name} {option.name}
</span> </span>
<span className="text-base-regular text-ui-fg-muted"> <span className="text-base text-muted-foreground">
{formatAddress( {formatAddress(
(option as unknown as { service_zone?: { fulfillment_set?: { location?: { address: HttpTypes.StoreCartAddress } } } }).service_zone?.fulfillment_set?.location (option as unknown as { service_zone?: { fulfillment_set?: { location?: { address: HttpTypes.StoreCartAddress } } } }).service_zone?.fulfillment_set?.location
?.address as HttpTypes.StoreCartAddress ?.address as HttpTypes.StoreCartAddress
@@ -351,7 +351,7 @@ const Shipping: React.FC<ShippingProps> = ({
</span> </span>
</div> </div>
</div> </div>
<span className="justify-self-end text-ui-fg-base"> <span className="justify-self-end text-foreground">
{convertToLocale({ {convertToLocale({
amount: option.amount!, amount: option.amount!,
currency_code: cart?.currency_code, currency_code: cart?.currency_code,
@@ -379,19 +379,19 @@ const Shipping: React.FC<ShippingProps> = ({
disabled={!cart.shipping_methods?.[0]} disabled={!cart.shipping_methods?.[0]}
data-testid="submit-delivery-option-button" data-testid="submit-delivery-option-button"
> >
Continue to payment Nastavite na plaćanje
</Button> </Button>
</div> </div>
</> </>
) : ( ) : (
<div> <div>
<div className="text-small-regular"> <div className="text-sm">
{cart && (cart.shipping_methods?.length ?? 0) > 0 && ( {cart && (cart.shipping_methods?.length ?? 0) > 0 && (
<div className="flex flex-col w-1/3"> <div className="flex flex-col w-1/3">
<Text className="txt-medium-plus text-ui-fg-base mb-1"> <Text className="text-sm font-medium text-foreground mb-1">
Method Način
</Text> </Text>
<Text className="txt-medium text-ui-fg-subtle"> <Text className="text-sm text-muted-foreground">
{cart.shipping_methods!.at(-1)!.name}{" "} {cart.shipping_methods!.at(-1)!.name}{" "}
{convertToLocale({ {convertToLocale({
amount: cart.shipping_methods!.at(-1)!.amount!, amount: cart.shipping_methods!.at(-1)!.amount!,

View File

@@ -1,30 +1,24 @@
import { Heading } from "@modules/common/components/ui"
import ItemsPreviewTemplate from "@modules/cart/templates/preview" import ItemsPreviewTemplate from "@modules/cart/templates/preview"
import DiscountCode from "@modules/checkout/components/discount-code" import DiscountCode from "@modules/checkout/components/discount-code"
import CartTotals from "@modules/common/components/cart-totals" import CartTotals from "@modules/common/components/cart-totals"
import Divider from "@modules/common/components/divider"
import { HttpTypes } from "@medusajs/types" import { HttpTypes } from "@medusajs/types"
const CheckoutSummary = ({ cart }: { cart: HttpTypes.StoreCart }) => { const CheckoutSummary = ({ cart }: { cart: HttpTypes.StoreCart }) => {
return ( return (
<div className="sticky top-0 flex flex-col-reverse small:flex-col gap-y-8 py-8 small:py-0 "> <aside className="lg:sticky lg:top-24 self-start">
<div className="w-full bg-white flex flex-col"> <div className="rounded-2xl bg-muted p-6 sm:p-8">
<Divider className="my-6 small:hidden" /> <p className="eyebrow text-muted-foreground">Vaša narudžba</p>
<Heading <div className="mt-4">
level="h2" <ItemsPreviewTemplate cart={cart} />
className="flex flex-row text-3xl-regular items-baseline" </div>
> <div className="mt-4 border-t border-border pt-6">
In your Cart <CartTotals totals={cart} />
</Heading> </div>
<Divider className="my-6" /> <div className="mt-6 border-t border-border pt-6">
<CartTotals totals={cart} />
<ItemsPreviewTemplate cart={cart} />
<div className="my-6">
<DiscountCode cart={cart} /> <DiscountCode cart={cart} />
</div> </div>
</div> </div>
</div> </aside>
) )
} }

View File

@@ -24,10 +24,10 @@ export default function CollectionTemplate({
const sort = sortBy || "created_at" const sort = sortBy || "created_at"
return ( return (
<div className="flex flex-col small:flex-row small:items-start py-6 content-container"> <div className="flex flex-col lg:flex-row lg:items-start py-6 content-container">
<RefinementList sortBy={sort} hideOptionsPicker /> <RefinementList sortBy={sort} hideOptionsPicker />
<div className="w-full"> <div className="w-full">
<div className="mb-8 text-2xl-semi"> <div className="mb-8 font-display text-2xl">
<h1>{collection.title}</h1> <h1>{collection.title}</h1>
</div> </div>
<Suspense <Suspense

View File

@@ -73,12 +73,12 @@ const CartTotals: React.FC<CartTotalsProps> = ({ totals }) => {
</div> </div>
</div> </div>
<Separator className="my-1" /> <Separator className="my-2" />
<div className="flex items-center justify-between text-foreground"> <div className="flex items-baseline justify-between text-foreground">
<span className="font-semibold text-base">Ukupno za uplatu</span> <span className="text-sm">Ukupno za uplatu</span>
<span <span
className="text-xl font-extrabold text-primary" className="font-display text-3xl tracking-tight text-foreground tabular-nums"
data-testid="cart-total" data-testid="cart-total"
data-value={total || 0} data-value={total || 0}
> >
@@ -86,10 +86,10 @@ const CartTotals: React.FC<CartTotalsProps> = ({ totals }) => {
</span> </span>
</div> </div>
<div className="mt-1 flex items-center gap-1.5 text-[11px] text-muted-foreground/90 bg-muted/40 p-2.5 rounded-lg border border-border/60"> <p className="flex items-center gap-1.5 text-xs text-muted-foreground">
<ShieldCheck className="w-3.5 h-3.5 text-emerald-600 shrink-0" /> <ShieldCheck className="h-3.5 w-3.5 shrink-0" />
<span>Fiskalni račun i R1 porezna faktura za firme sa JIB/PDV brojem</span> Fiskalni račun i R1 faktura za firme s JIB/PDV brojem
</div> </p>
</div> </div>
) )
} }

Some files were not shown because too many files have changed in this diff Show More