Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f49ef11c9c | ||
|
|
421760dc62 | ||
|
|
0390a35d01 | ||
|
|
4cd34106b0 | ||
|
|
1ef621f832 | ||
|
|
d5a7ed8092 | ||
|
|
ba464e8345 | ||
|
|
7c73714d56 | ||
|
|
fe86b58012 | ||
|
|
c4d9351e91 | ||
|
|
7e7ebc88b6 | ||
|
|
107413069c | ||
|
|
f9915e4f8c |
@@ -1,8 +1,2 @@
|
|||||||
# Copy this file to .env.local and fill in your real keys.
|
# Optional backend API base URL. Copy to .env.local to configure.
|
||||||
|
|
||||||
# Neshan (نشان) map API key — get one from https://platform.neshan.org
|
|
||||||
# Used by components/MapSection.jsx for the static map image.
|
|
||||||
NEXT_PUBLIC_NESHAN_API_KEY=
|
|
||||||
|
|
||||||
|
|
||||||
NEXT_PUBLIC_API_BASE_URL=https://your-real-backend.com
|
NEXT_PUBLIC_API_BASE_URL=https://your-real-backend.com
|
||||||
@@ -33,9 +33,11 @@ jobs:
|
|||||||
docker build -t robot-market:${{ steps.vars.outputs.sha }} .
|
docker build -t robot-market:${{ steps.vars.outputs.sha }} .
|
||||||
|
|
||||||
- name: Save previous tag for rollback
|
- name: Save previous tag for rollback
|
||||||
|
id: backup
|
||||||
run: |
|
run: |
|
||||||
if [ -f /opt/robot-market-front/.env ]; then
|
if [ -f /opt/robot-market-front/.env ]; then
|
||||||
cp /opt/robot-market-front/.env /opt/robot-market-front/.env.previous
|
cp /opt/robot-market-front/.env /opt/robot-market-front/.env.previous
|
||||||
|
echo "available=true" >> "$GITHUB_OUTPUT"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Point compose at this build
|
- name: Point compose at this build
|
||||||
@@ -43,12 +45,14 @@ jobs:
|
|||||||
echo "IMAGE_TAG=${{ steps.vars.outputs.sha }}" > /opt/robot-market-front/.env
|
echo "IMAGE_TAG=${{ steps.vars.outputs.sha }}" > /opt/robot-market-front/.env
|
||||||
|
|
||||||
- name: Deploy via compose
|
- name: Deploy via compose
|
||||||
|
id: deploy
|
||||||
run: |
|
run: |
|
||||||
docker compose --env-file /opt/robot-market-front/.env \
|
docker compose --env-file /opt/robot-market-front/.env \
|
||||||
-f /opt/robot-market-front/docker-compose.yml \
|
-f /opt/robot-market-front/docker-compose.yml \
|
||||||
up -d --force-recreate
|
up -d --force-recreate
|
||||||
|
|
||||||
- name: Health check (retries for ~30s)
|
- name: Health check (retries for ~30s)
|
||||||
|
id: health
|
||||||
run: |
|
run: |
|
||||||
for i in $(seq 1 15); do
|
for i in $(seq 1 15); do
|
||||||
if docker exec robot-market node -e "
|
if docker exec robot-market node -e "
|
||||||
@@ -65,8 +69,8 @@ jobs:
|
|||||||
echo "Health check failed after 30s"
|
echo "Health check failed after 30s"
|
||||||
exit 1
|
exit 1
|
||||||
|
|
||||||
- name: Roll back to previous version on failed health check
|
- name: Roll back after deployment or health check failure
|
||||||
if: failure()
|
if: ${{ failure() && steps.backup.outputs.available == 'true' && (steps.deploy.outcome == 'failure' || steps.health.outcome == 'failure') }}
|
||||||
run: |
|
run: |
|
||||||
if [ -f /opt/robot-market-front/.env.previous ]; then
|
if [ -f /opt/robot-market-front/.env.previous ]; then
|
||||||
cp /opt/robot-market-front/.env.previous /opt/robot-market-front/.env
|
cp /opt/robot-market-front/.env.previous /opt/robot-market-front/.env
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ out/
|
|||||||
.env*.local
|
.env*.local
|
||||||
.DS_Store
|
.DS_Store
|
||||||
npm-debug.log*
|
npm-debug.log*
|
||||||
|
*.tsbuildinfo
|
||||||
|
|||||||
@@ -14,6 +14,9 @@
|
|||||||
<Item>
|
<Item>
|
||||||
<option name="path" value=".gitea/workflows/test.yml" />
|
<option name="path" value=".gitea/workflows/test.yml" />
|
||||||
</Item>
|
</Item>
|
||||||
|
<Item>
|
||||||
|
<option name="path" value=".gitea/workflows/develop.yml" />
|
||||||
|
</Item>
|
||||||
</list>
|
</list>
|
||||||
</option>
|
</option>
|
||||||
</SchemaInfo>
|
</SchemaInfo>
|
||||||
|
|||||||
@@ -4,9 +4,20 @@
|
|||||||
<option name="autoReloadType" value="SELECTIVE" />
|
<option name="autoReloadType" value="SELECTIVE" />
|
||||||
</component>
|
</component>
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="bb7b50a5-be9c-4cd7-a05b-979f0e91b173" name="Changes" comment="initial new branch">
|
<list default="true" id="bb7b50a5-be9c-4cd7-a05b-979f0e91b173" name="Changes" comment="feat: add cart and product pages, quantity controls, and first-visit development notice">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/data/content.js" beforeDir="false" afterPath="$PROJECT_DIR$/data/content.js" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/README.md" beforeDir="false" afterPath="$PROJECT_DIR$/README.md" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/app/products/[id]/page.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/app/products/[id]/page.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/CartPage.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/CartPage.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/Footer.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/Footer.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/Header.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/Header.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/HorizontalShowcase.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/HorizontalShowcase.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/MobileShowcase.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/MobileShowcase.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/ProductDetails.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/ProductDetails.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/components/ShowcaseSection.tsx" beforeDir="false" afterPath="$PROJECT_DIR$/components/ShowcaseSection.tsx" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/data/commerce.ts" beforeDir="false" afterPath="$PROJECT_DIR$/data/commerce.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/data/content.ts" beforeDir="false" afterPath="$PROJECT_DIR$/data/content.ts" afterDir="false" />
|
||||||
|
<change beforePath="$PROJECT_DIR$/types/domain.ts" beforeDir="false" afterPath="$PROJECT_DIR$/types/domain.ts" afterDir="false" />
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -28,61 +39,61 @@
|
|||||||
</component>
|
</component>
|
||||||
<component name="NextEditCompletionFeaturesState">
|
<component name="NextEditCompletionFeaturesState">
|
||||||
<decayedCancelled>
|
<decayedCancelled>
|
||||||
<entry key="MS100" value="1.7659734554897204" />
|
<entry key="MS100" value="5.636161152320107E-5" />
|
||||||
<entry key="MS500" value="2.6200917385797573" />
|
<entry key="MS500" value="0.2302465263814015" />
|
||||||
<entry key="S2" value="2.895672466750576" />
|
<entry key="S2" value="1.9612794450498428" />
|
||||||
<entry key="S5" value="2.9711768722246337" />
|
<entry key="S5" value="3.4102363921166443" />
|
||||||
<entry key="S10" value="3.095911797960576" />
|
<entry key="S10" value="4.5184216736456175" />
|
||||||
<entry key="S30" value="3.6130929483281937" />
|
<entry key="S30" value="6.985270524998366" />
|
||||||
<entry key="S60" value="4.862542006443887" />
|
<entry key="S60" value="9.574915616687461" />
|
||||||
<entry key="M2" value="8.222118193057797" />
|
<entry key="M2" value="13.91167227171946" />
|
||||||
<entry key="M5" value="14.352669475563026" />
|
<entry key="M5" value="22.10409689222133" />
|
||||||
<entry key="M10" value="18.025488407782152" />
|
<entry key="M10" value="27.65756793067821" />
|
||||||
<entry key="M15" value="19.665360290707866" />
|
<entry key="M15" value="30.196404421732346" />
|
||||||
<entry key="M30" value="22.62190726116564" />
|
<entry key="M30" value="34.20114919146407" />
|
||||||
<entry key="H1" value="26.416500535541072" />
|
<entry key="H1" value="38.596318396422" />
|
||||||
<entry key="H2" value="30.051114228090462" />
|
<entry key="H2" value="42.58982972864479" />
|
||||||
<entry key="H4" value="32.65287419479587" />
|
<entry key="H4" value="45.40405035457018" />
|
||||||
<entry key="D1" value="35.38129255958758" />
|
<entry key="D1" value="48.33665386421948" />
|
||||||
<entry key="W1" value="35.9099877286286" />
|
<entry key="W1" value="48.9035231768996" />
|
||||||
</decayedCancelled>
|
</decayedCancelled>
|
||||||
<decayedSelected>
|
<decayedSelected>
|
||||||
<entry key="MS100" value="0.0" />
|
<entry key="MS100" value="1.0" />
|
||||||
<entry key="MS500" value="1.5499348360687339E-164" />
|
<entry key="MS500" value="1.0" />
|
||||||
<entry key="S2" value="1.1157794535925266E-41" />
|
<entry key="S2" value="1.0" />
|
||||||
<entry key="S5" value="4.1594062872493325E-17" />
|
<entry key="S5" value="1.0" />
|
||||||
<entry key="S10" value="6.449345925944224E-9" />
|
<entry key="S10" value="1.0000000000004026" />
|
||||||
<entry key="S30" value="0.0018613950614188026" />
|
<entry key="S30" value="1.0000738385287775" />
|
||||||
<entry key="S60" value="0.043143887880194604" />
|
<entry key="S60" value="1.0085929348174816" />
|
||||||
<entry key="M2" value="0.20771106826597993" />
|
<entry key="M2" value="1.0926980842168899" />
|
||||||
<entry key="M5" value="0.533315069904893" />
|
<entry key="M5" value="1.3862142586684925" />
|
||||||
<entry key="M10" value="0.7302842391185045" />
|
<entry key="M10" value="1.6214613895235106" />
|
||||||
<entry key="M15" value="0.8109510091490459" />
|
<entry key="M15" value="1.7282426350470148" />
|
||||||
<entry key="M30" value="0.9005281834285062" />
|
<entry key="M30" value="1.853371334793368" />
|
||||||
<entry key="H1" value="0.9489616343290734" />
|
<entry key="H1" value="1.9237809993680148" />
|
||||||
<entry key="H2" value="0.9741466184969663" />
|
<entry key="H2" value="1.9611352659059051" />
|
||||||
<entry key="H4" value="0.986988661787442" />
|
<entry key="H4" value="1.9803750638943771" />
|
||||||
<entry key="D1" value="0.9978195926881375" />
|
<entry key="D1" value="1.9967021063244244" />
|
||||||
<entry key="W1" value="0.9996882217756649" />
|
<entry key="W1" value="1.9995282050855745" />
|
||||||
</decayedSelected>
|
</decayedSelected>
|
||||||
<decayedShown>
|
<decayedShown>
|
||||||
<entry key="MS100" value="1.6363299214720612" />
|
<entry key="MS100" value="5.673108319866789E-5" />
|
||||||
<entry key="MS500" value="2.580440430635064" />
|
<entry key="MS500" value="0.2755608628441334" />
|
||||||
<entry key="S2" value="2.884654206650678" />
|
<entry key="S2" value="2.398322303413965" />
|
||||||
<entry key="S5" value="2.9666305108034594" />
|
<entry key="S5" value="4.121762152287479" />
|
||||||
<entry key="S10" value="3.0934710562664876" />
|
<entry key="S10" value="5.358118199319534" />
|
||||||
<entry key="S30" value="3.6138341741583195" />
|
<entry key="S30" value="7.924594218734951" />
|
||||||
<entry key="S60" value="4.903918162005831" />
|
<entry key="S60" value="10.550212525549737" />
|
||||||
<entry key="M2" value="8.426649355082025" />
|
<entry key="M2" value="14.985181048549935" />
|
||||||
<entry key="M5" value="14.882896956006677" />
|
<entry key="M5" value="23.480472743765223" />
|
||||||
<entry key="M10" value="18.75367770497998" />
|
<entry key="M10" value="29.27333974135673" />
|
||||||
<entry key="M15" value="20.474761353109788" />
|
<entry key="M15" value="31.92062506542455" />
|
||||||
<entry key="M30" value="23.521564444287325" />
|
<entry key="M30" value="36.05236671041284" />
|
||||||
<entry key="H1" value="27.364990222969524" />
|
<entry key="H1" value="40.518972305385134" />
|
||||||
<entry key="H2" value="31.025011433737856" />
|
<entry key="H2" value="44.55038420189922" />
|
||||||
<entry key="H4" value="33.639733831212105" />
|
<entry key="H4" value="47.38412968080923" />
|
||||||
<entry key="D1" value="36.37908993480534" />
|
<entry key="D1" value="50.33330581758772" />
|
||||||
<entry key="W1" value="36.90967275725512" />
|
<entry key="W1" value="50.9030441942503" />
|
||||||
</decayedShown>
|
</decayedShown>
|
||||||
</component>
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
@@ -103,12 +114,14 @@
|
|||||||
"RunOnceActivity.git.unshallow": "true",
|
"RunOnceActivity.git.unshallow": "true",
|
||||||
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
"RunOnceActivity.typescript.service.memoryLimit.init": "true",
|
||||||
"codeWithMe.voiceChat.enabledByDefault": "false",
|
"codeWithMe.voiceChat.enabledByDefault": "false",
|
||||||
|
"com.intellij.ml.llm.matterhorn.ej.ui.settings.DefaultModelSelectionForGA.v1": "true",
|
||||||
"git-widget-placeholder": "develop",
|
"git-widget-placeholder": "develop",
|
||||||
"javascript.nodejs.core.library.configured.version": "24.20.0",
|
"javascript.nodejs.core.library.configured.version": "24.20.0",
|
||||||
"javascript.nodejs.core.library.typings.version": "24.13.3",
|
"javascript.nodejs.core.library.typings.version": "24.13.3",
|
||||||
"javascript.preferred.runtime.type.id": "node",
|
"javascript.preferred.runtime.type.id": "node",
|
||||||
"js.debugger.nextJs.config.created.client": "true",
|
"js.debugger.nextJs.config.created.client": "true",
|
||||||
"js.debugger.nextJs.config.created.server": "true",
|
"js.debugger.nextJs.config.created.server": "true",
|
||||||
|
"junie.onboarding.icon.badge.shown": "true",
|
||||||
"kronk.content.tree.expanded.paths": "",
|
"kronk.content.tree.expanded.paths": "",
|
||||||
"last_opened_file_path": "/home/hamed/Documents/Projects/GItLabRepo/device_web",
|
"last_opened_file_path": "/home/hamed/Documents/Projects/GItLabRepo/device_web",
|
||||||
"node.js.detected.package.eslint": "true",
|
"node.js.detected.package.eslint": "true",
|
||||||
@@ -117,7 +130,8 @@
|
|||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "editor.preferences.fonts.default",
|
"settings.editor.selected.configurable": "editor.preferences.fonts.default",
|
||||||
"ts.external.directory.path": "C:\\Program Files\\JetBrains\\WebStorm 2026.1.1\\plugins\\javascript-plugin\\jsLanguageServicesImpl\\external",
|
"to.speed.mode.migration.done": "true",
|
||||||
|
"ts.external.directory.path": "/home/hamed/Documents/Projects/GIthubRepo/robot-market-landing/node_modules/typescript/lib",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
}</component>
|
}</component>
|
||||||
@@ -188,6 +202,23 @@
|
|||||||
<workItem from="1788592387411" duration="8000" />
|
<workItem from="1788592387411" duration="8000" />
|
||||||
<workItem from="1788592424522" duration="13793000" />
|
<workItem from="1788592424522" duration="13793000" />
|
||||||
<workItem from="1788670304118" duration="1889000" />
|
<workItem from="1788670304118" duration="1889000" />
|
||||||
|
<workItem from="1788772211468" duration="3288000" />
|
||||||
|
<workItem from="1788845304938" duration="5986000" />
|
||||||
|
<workItem from="1789189667293" duration="1409000" />
|
||||||
|
<workItem from="1789191385769" duration="3038000" />
|
||||||
|
<workItem from="1789200888982" duration="408000" />
|
||||||
|
<workItem from="1789202103910" duration="646000" />
|
||||||
|
<workItem from="1789202776318" duration="599000" />
|
||||||
|
<workItem from="1789207496509" duration="153000" />
|
||||||
|
<workItem from="1789278993260" duration="734000" />
|
||||||
|
<workItem from="1789360783891" duration="48000" />
|
||||||
|
<workItem from="1789361888102" duration="68000" />
|
||||||
|
<workItem from="1789362025574" duration="23000" />
|
||||||
|
<workItem from="1789362137185" duration="377000" />
|
||||||
|
<workItem from="1789362644534" duration="6512000" />
|
||||||
|
<workItem from="1789383269194" duration="2337000" />
|
||||||
|
<workItem from="1789445417779" duration="6709000" />
|
||||||
|
<workItem from="1789456504019" duration="1703000" />
|
||||||
</task>
|
</task>
|
||||||
<task id="LOCAL-00001" summary="update">
|
<task id="LOCAL-00001" summary="update">
|
||||||
<option name="closed" value="true" />
|
<option name="closed" value="true" />
|
||||||
@@ -413,21 +444,102 @@
|
|||||||
<option name="project" value="LOCAL" />
|
<option name="project" value="LOCAL" />
|
||||||
<updated>1788682678051</updated>
|
<updated>1788682678051</updated>
|
||||||
</task>
|
</task>
|
||||||
<option name="localTasksCounter" value="29" />
|
<task id="LOCAL-00029" summary="update">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789191804591</created>
|
||||||
|
<option name="number" value="00029" />
|
||||||
|
<option name="presentableId" value="LOCAL-00029" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789191804591</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00030" summary="update">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789362384351</created>
|
||||||
|
<option name="number" value="00030" />
|
||||||
|
<option name="presentableId" value="LOCAL-00030" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789362384351</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00031" summary="feat: add landing page device images and fix machine branding">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789367962553</created>
|
||||||
|
<option name="number" value="00031" />
|
||||||
|
<option name="presentableId" value="LOCAL-00031" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789367962553</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00032" summary="feat: add landing page device images and fix machine branding">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789368598921</created>
|
||||||
|
<option name="number" value="00032" />
|
||||||
|
<option name="presentableId" value="LOCAL-00032" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789368598921</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00033" summary="feat: add landing page device images and fix machine branding">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789369799782</created>
|
||||||
|
<option name="number" value="00033" />
|
||||||
|
<option name="presentableId" value="LOCAL-00033" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789369799782</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00034" summary="refactor: remove disabled home sections and their unused assets">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789384147873</created>
|
||||||
|
<option name="number" value="00034" />
|
||||||
|
<option name="presentableId" value="LOCAL-00034" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789384147873</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00035" summary="refactor: migrate project to TypeScript and translate comments to English">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789385239281</created>
|
||||||
|
<option name="number" value="00035" />
|
||||||
|
<option name="presentableId" value="LOCAL-00035" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789385239281</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00036" summary="feat: add cart and product pages, quantity controls, and first-visit development notice">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789449280006</created>
|
||||||
|
<option name="number" value="00036" />
|
||||||
|
<option name="presentableId" value="LOCAL-00036" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789449280006</updated>
|
||||||
|
</task>
|
||||||
|
<task id="LOCAL-00037" summary="feat: add cart and product pages, quantity controls, and first-visit development notice">
|
||||||
|
<option name="closed" value="true" />
|
||||||
|
<created>1789451442320</created>
|
||||||
|
<option name="number" value="00037" />
|
||||||
|
<option name="presentableId" value="LOCAL-00037" />
|
||||||
|
<option name="project" value="LOCAL" />
|
||||||
|
<updated>1789451442320</updated>
|
||||||
|
</task>
|
||||||
|
<option name="localTasksCounter" value="38" />
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
<component name="TypeScriptGeneratedFilesManager">
|
||||||
<option name="version" value="3" />
|
<option name="version" value="3" />
|
||||||
|
<option name="exactExcludedFiles">
|
||||||
|
<list>
|
||||||
|
<option value="$PROJECT_DIR$/components/AboutSection.jsx" />
|
||||||
|
</list>
|
||||||
|
</option>
|
||||||
</component>
|
</component>
|
||||||
<component name="UnknownFeatures">
|
<component name="UnknownFeatures">
|
||||||
<option featureType="com.intellij.fileTypeFactory" implementationName="next.config.js" />
|
<option featureType="com.intellij.fileTypeFactory" implementationName="next.config.js" />
|
||||||
</component>
|
</component>
|
||||||
<component name="VcsManagerConfiguration">
|
<component name="VcsManagerConfiguration">
|
||||||
<MESSAGE value="ui : change the position of header in Hero Section" />
|
<MESSAGE value="ui : change the position of header in Hero Section" />
|
||||||
<MESSAGE value="update" />
|
|
||||||
<MESSAGE value="feat:dockerized & test actions add" />
|
<MESSAGE value="feat:dockerized & test actions add" />
|
||||||
<MESSAGE value="feat:dockerized & test actions added" />
|
<MESSAGE value="feat:dockerized & test actions added" />
|
||||||
<MESSAGE value="initial new branch" />
|
<MESSAGE value="initial new branch" />
|
||||||
<option name="LAST_COMMIT_MESSAGE" value="initial new branch" />
|
<MESSAGE value="update" />
|
||||||
|
<MESSAGE value="feat: add landing page device images and fix machine branding" />
|
||||||
|
<MESSAGE value="refactor: remove disabled home sections and their unused assets" />
|
||||||
|
<MESSAGE value="refactor: migrate project to TypeScript and translate comments to English" />
|
||||||
|
<MESSAGE value="feat: add cart and product pages, quantity controls, and first-visit development notice" />
|
||||||
|
<option name="LAST_COMMIT_MESSAGE" value="feat: add cart and product pages, quantity controls, and first-visit development notice" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
||||||
@@ -1,132 +1,74 @@
|
|||||||
# روبات مارکت — Vending Machine Showcase
|
# روبات مارکت — Vending Machine Showcase
|
||||||
|
|
||||||
پروژه Next.js (App Router) صفحه معرفی محصولات «روبات مارکت»، با انیمیشنهای GSAP/ScrollTrigger،
|
صفحه معرفی دستگاههای وندینگ روبات مارکت، ساختهشده با Next.js، TypeScript، React و Ant Design.
|
||||||
مدیریت سبد خرید با Redux Toolkit، حالت تیره/روشن، دو زبانه (فارسی/انگلیسی)، نقشه، فرم تیکت
|
|
||||||
پشتیبانی، و ویجت چت.
|
|
||||||
|
|
||||||
## اجرای پروژه
|
## اجرا
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
npm install
|
npm install
|
||||||
npm run dev
|
npm run dev
|
||||||
```
|
```
|
||||||
|
|
||||||
سپس `http://localhost:3000` را باز کنید.
|
سایت در http://localhost:3000 در دسترس است.
|
||||||
|
|
||||||
## ساختار پروژه
|
## بررسی نوعها
|
||||||
|
|
||||||
```
|
```bash
|
||||||
app/
|
npm run typecheck
|
||||||
layout.jsx # پوسته HTML، فونت وزیرمتن
|
|
||||||
page.jsx # چیدمان کامل صفحه
|
|
||||||
providers.jsx # Redux + Theme + Language + AntD ConfigProvider
|
|
||||||
globals.css # توکنهای رنگ دارک/لایت، جلوه اسپاتلایت، تایپرایتر
|
|
||||||
context/
|
|
||||||
ThemeContext.jsx # حالت دارک/لایت (ذخیره در localStorage)
|
|
||||||
LanguageContext.jsx # زبان فا/en (ذخیره در localStorage + جهت صفحه)
|
|
||||||
store/ # Redux (سبد خرید)
|
|
||||||
data/
|
|
||||||
content.js # منبع واحد محتوای دوزبانه (fa/en) — همهی متنها اینجاست
|
|
||||||
components/
|
|
||||||
Header.jsx # هدر + سوییچ زبان/تم + دکمه ورود به پنل کاربری
|
|
||||||
ThemeToggle.jsx / LanguageToggle.jsx
|
|
||||||
HeroSection.jsx # هدلاین تایپشونده + پسزمینه رنگی در حال چرخش
|
|
||||||
HorizontalShowcase.jsx # اسکرول افقی پینشده + ویدیوی پسزمینه
|
|
||||||
VendingCard.jsx # کارت دستگاه + جلوه اسپاتلایت
|
|
||||||
FloatingItems.jsx
|
|
||||||
FeaturesSection.jsx
|
|
||||||
AboutSection.jsx
|
|
||||||
LocationsSection.jsx
|
|
||||||
MapSection.jsx # نقشه Neshan (کلید API را خودتان اضافه میکنید)
|
|
||||||
CatalogSection.jsx # کاتالوگ محصولات قابل سفارش
|
|
||||||
IntroVideoSection.jsx # ویدیوی معرفی شرکت
|
|
||||||
TicketForm.jsx # فرم تیکت پشتیبانی
|
|
||||||
ChatWidget.jsx # آیکون شناور چت + مودال گفتگو
|
|
||||||
CartDrawer.jsx
|
|
||||||
Footer.jsx
|
|
||||||
public/
|
|
||||||
images/, gifs/, video/ # داراییهای placeholder — در پیام قبلی توضیح داده شده
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## ویژگیهای اضافهشده در این نسخه
|
کد برنامه با TypeScript و حالت strict بررسی میشود. نوعهای مشترک در `types/domain.ts` و هوکهای Redux در `store/hooks.ts` قرار دارند.
|
||||||
|
تنظیمات Next.js و PostCSS برای سازگاری با ابزارهای فعلی به JavaScript باقی ماندهاند؛ تنظیمات Tailwind در `tailwind.config.ts` است.
|
||||||
|
|
||||||
### نقشه (Neshan)
|
## ساخت نسخه نهایی
|
||||||
`components/MapSection.jsx` از **Neshan Static Map API** استفاده میکند (یک تصویر ساده، بدون نیاز
|
|
||||||
به اسکریپت/SDK جاوااسکریپت). کلید API را اینجا وارد کنید:
|
|
||||||
|
|
||||||
1. یک فایل `.env.local` در ریشه پروژه بسازید (از روی `.env.local.example` کپی کنید)
|
```bash
|
||||||
2. مقدار `NEXT_PUBLIC_NESHAN_API_KEY` را با کلید واقعی خودتان از
|
npm run build
|
||||||
[platform.neshan.org](https://platform.neshan.org) پر کنید
|
npm start
|
||||||
|
```
|
||||||
|
|
||||||
تا وقتی کلید خالی باشد، بهجای نقشه یک پیام راهنما («برای فعال شدن نقشه، کلید API نشان را در
|
خروجی standalone برای اجرای Docker تنظیم شده است.
|
||||||
تنظیمات پروژه قرار دهید») نمایش داده میشود — سایت خراب نمیشود. نقشه در حالت تیره/روشن هم استایل
|
|
||||||
متفاوتی میگیرد (`standard-night` / `standard-day`). لینک «مشاهده در نشان» کنار هر آدرس به نقشه
|
|
||||||
تعاملی neshan.org میرود و نیازی به کلید ندارد. مختصات فعلی در `data/content.js`
|
|
||||||
(`mapLocations`) تقریبی هستند — با پین دقیق جایگزین کنید.
|
|
||||||
|
|
||||||
### کاتالوگ محصولات
|
## ساختار و بخشهای فعال
|
||||||
`components/CatalogSection.jsx` — گرید محصولاتی (زعفران، تنقلات، نوشیدنی، قهوه، چای و ...) که
|
|
||||||
مشتریان دستگاه میتوانند با قیمت کمتر از بازار سفارش دهند. هر آیتم قیمت بازار (خطخورده) و قیمت
|
|
||||||
ویژه را نشان میدهد و دکمه «افزودن به سفارش» آن را به همان سبد خرید Redux اضافه میکند (در کنار
|
|
||||||
دستگاهها). لیست محصولات، قیمتها و تصاویر در `data/content.js` (کلید `catalog`) قابل ویرایش است؛
|
|
||||||
تصاویر placeholder در `public/images/catalog/` قرار دارند.
|
|
||||||
|
|
||||||
### سکشن ویدیوی معرفی شرکت
|
- `app/page.tsx`: صفحه اصلی شامل هیرو، ویترین دستگاهها، مزایا، درباره ما و محلهای مناسب نصب.
|
||||||
`components/IntroVideoSection.jsx` — یک پلیر ویدیوی مستقل (جدا از ویدیوی پسزمینه اسکرول افقی) با
|
- `app/layout.tsx`: هدر، فوتر و پیام توسعه مشترک بین صفحات.
|
||||||
پوستر و دکمه پخش استاندارد مرورگر. برای جایگزینی، فایل واقعی را در
|
- `app/cart/page.tsx`: صفحه مستقل سبد خرید.
|
||||||
`public/video/company-intro-placeholder.mp4` بگذارید (یا مسیر `introVideoSrc` را در
|
- `app/products/page.tsx`: همه محصولات با فیلتر دستهبندی ذخیرهشده در URL؛ برای نمونه `/products?category=warm-vending`.
|
||||||
`data/content.js` عوض کنید)؛ پوستر هم از `public/images/video-poster.svg` میآید.
|
- `data/products.ts`: دستهبندیها و شناسه سه محصول منتخب ویترین اسکرولی Home؛ سایر محصولات فقط در فهرست کامل نمایش داده میشوند.
|
||||||
|
- `app/products/[id]/page.tsx`: صفحه جزئیات هر دستگاه، تصاویر، ویژگیها و کنترل تعداد.
|
||||||
|
- `components/HeroSection.tsx`: اسلایدر تصاویر دستگاهها.
|
||||||
|
- `components/ShowcaseSection.tsx`: انتخاب نمایش موبایل یا ویترین افقی دسکتاپ.
|
||||||
|
- `components/HorizontalShowcase.tsx`: ویترین افقی با GSAP و ویدیوی پسزمینه وابسته به اسکرول.
|
||||||
|
- `components/MobileShowcase.tsx`: فهرست دستگاهها در موبایل.
|
||||||
|
- `components/VendingCard.tsx` و `components/FloatingItems.tsx`: نمایش دستگاه و جلوههای تصویری.
|
||||||
|
- `components/CartPage.tsx`، `components/QuantityControl.tsx` و `store/`: سبد خرید و کنترل افزایش و کاهش تعداد با Redux.
|
||||||
|
- `components/CartPersistence.tsx`: حفظ شناسه و تعداد دستگاهها در مرورگر.
|
||||||
|
- `components/DevelopmentNotice.tsx`: پیام اولین بازدید؛ پس از بستهشدن دوباره در همان مرورگر نمایش داده نمیشود.
|
||||||
|
- `data/content.ts`: محتوای فارسی و انگلیسی، مشخصات و قیمت دستگاهها و مسیر رسانهها.
|
||||||
|
- `data/commerce.ts`: متنهای دوزبانه سبد خرید، جزئیات محصول و پیام توسعه.
|
||||||
|
- `app/context/` و `app/providers.tsx`: زبان، جهت صفحه، تم و تنظیمات Ant Design.
|
||||||
|
- `app/globals.css`: رنگها و استایلهای مشترک.
|
||||||
|
- `public/`: تصاویر دستگاهها، اقلام شناور، گیفها و ویدیوی ویترین.
|
||||||
|
|
||||||
### رنگبندی متناوب سکشنها
|
## زبان و تم
|
||||||
هر سکشن اصلی صفحه (بهجز هیرو و بخش اسکرول افقی که پسزمینه مخصوص خودشان را دارند) بهترتیب بین سه
|
|
||||||
تن رنگی برند میچرخد: `bg-page` → `bg-surface` → `bg-elevated` → ... بههمراه یک خط جداکننده ظریف
|
|
||||||
بالای هر بخش. اینها همان توکنهای دارک/لایت هستند، پس با تغییر تم هم هماهنگ میمانند. برای تغییر
|
|
||||||
ترتیب یا اضافه کردن سکشن جدید، کافیست یکی از این سه کلاس را روی `<section>` بگذارید.
|
|
||||||
|
|
||||||
### حالت دارک/لایت
|
زبان فارسی/انگلیسی و حالت روشن/تیره از هدر تغییر میکنند و ترجیح کاربر در localStorage ذخیره میشود.
|
||||||
دکمه سوییچ در هدر (آیکون خورشید/ماه). ترجیح در `localStorage` ذخیره میشود و در اولین بار بر اساس
|
ویترین افقی برای محاسبات اسکرول همیشه جهت LTR دارد، اما متن کارتها جهت زبان فعال را رعایت میکند.
|
||||||
تنظیمات سیستم کاربر تعیین میشود. رنگبندی از طریق متغیرهای CSS در `app/globals.css`
|
|
||||||
(`--color-bg-page`, `--color-text-primary`, ...) و کلاسهای کمکی `bg-page` / `bg-surface` /
|
|
||||||
`text-primary` / `text-secondary` / `border-subtle` مدیریت میشود؛ برای هر رنگ جدید فقط همینجا را
|
|
||||||
ویرایش کنید. تم Ant Design هم بهصورت خودکار (`darkAlgorithm` / `defaultAlgorithm`) هماهنگ میشود.
|
|
||||||
|
|
||||||
### دو زبانه (فارسی / انگلیسی)
|
## ورود و سبد خرید
|
||||||
دکمه «EN / فا» در هدر. تمام متنهای سایت (منو، هیرو، محصولات، درباره ما، مکانهای نصب، فرم تیکت،
|
|
||||||
چت، فوتر) از `data/content.js` خوانده میشوند — یک آبجکت با کلیدهای `fa` و `en`. تغییر زبان همچنین
|
|
||||||
جهت صفحه (`dir`) و `lang` تگ `html` را بهروزرسانی میکند. برای اضافه یا اصلاح متن، فقط
|
|
||||||
`data/content.js` را ویرایش کنید؛ کامپوننتها نیازی به تغییر ندارند.
|
|
||||||
|
|
||||||
> نکته فنی: بخش اسکرول افقی (`HorizontalShowcase`) بهعمد همیشه `dir="ltr"` روی خود track دارد
|
دکمه ورود به https://panel.my-rm.com متصل است.
|
||||||
> (چون محاسبات GSAP به آن نیاز دارد)، اما هر کارت داخلش جهت متن را بر اساس زبان فعال تنظیم میکند.
|
سبد خرید در مسیر `/cart` نمایش داده میشود و انتخابها پس از بارگذاری مجدد حفظ میشوند.
|
||||||
|
کنترلهای مثبت و منفی در کارتها، صفحه محصول و سبد هماهنگاند؛ کاهش تعداد از یک به صفر دستگاه را از سبد حذف میکند.
|
||||||
|
پرداخت هنوز متصل نیست؛ دکمه پرداخت غیرفعال است و توضیح آن نمایش داده میشود.
|
||||||
|
|
||||||
### فرم تیکت پشتیبانی
|
## تنظیم API
|
||||||
`components/TicketForm.jsx` — فرم Ant Design با اعتبارسنجی (نام، تلفن، ایمیل اختیاری، موضوع،
|
|
||||||
اولویت، پیام). ارسال فعلاً فقط یک پیام موفقیت نمایش میدهد؛ بلوک کامنتشده
|
|
||||||
`// TODO: Connect to the real ticketing/support API` دقیقاً نشان میدهد کجا باید axios را وصل کنید.
|
|
||||||
|
|
||||||
### ویجت چت
|
برای تعیین آدرس بکاند، از `.env.local.example` یک فایل `.env.local` بسازید و
|
||||||
دکمه شناور گوشه صفحه (`components/ChatWidget.jsx`) یک مودال گفتگوی ساده باز میکند. پیامها فعلاً
|
`NEXT_PUBLIC_API_BASE_URL` را تنظیم کنید. کلاینت مشترک API در `lib/axios.ts` قرار دارد.
|
||||||
در state محلی نگهداری میشوند و یک پاسخ خودکار نمایشی میدهند. بلوک
|
|
||||||
`// TODO: Connect to a real chat/support backend` محل اتصال به بکاند واقعی (یا وبسوکت) را مشخص
|
|
||||||
کرده.
|
|
||||||
|
|
||||||
### هیرو: تایپرایتر + پسزمینه رنگی در حال تغییر
|
## جایگزینی رسانهها
|
||||||
هدلاین با افکت تایپرایتر بین چند جمله (`data/content.js` → `hero.typingPhrases`) میچرخد.
|
|
||||||
پسزمینه بهصورت حلقهای بین سبز برند (`#00a693`)، مشکی و سفید تغییر رنگ میدهد (با GSAP). یک لایه
|
|
||||||
scrim تیره روی آن قرار دارد تا متن در هر سه حالت خوانا بماند. وقتی ویدیوی هیرو را آماده کردید،
|
|
||||||
داخل `components/HeroSection.jsx` یک بلوک `TODO` کامنتشده دقیقاً نشان میدهد چطور بهجای پسزمینه
|
|
||||||
رنگی، ویدیو را جایگزین کنید (فقط از حالت کامنت خارجش کنید).
|
|
||||||
|
|
||||||
### ورود به پنل کاربری
|
فایلهای واقعی را با مسیرهای موجود در `data/content.ts` جایگزین کنید یا مسیرها را در همان فایل تغییر دهید.
|
||||||
دکمه «ورود به پنل کاربری» / «Sign In» در هدر اضافه شده (در `components/Header.jsx`). چون گفتید
|
ویدیوی پسزمینه ویترین از `public/video/showcase-placeholder.mp4` خوانده میشود.
|
||||||
لینکدهی را خودتان انجام میدهید، فعلاً فقط یک `onClick` خالی با کامنت TODO دارد — مسیر واقعی پنل
|
|
||||||
کاربری را همانجا وصل کنید.
|
|
||||||
|
|
||||||
## جایگزینی داراییهای واقعی (تصاویر/گیف/ویدیو)
|
|
||||||
همانطور که قبلاً توضیح داده شد، فایلهای داخل `public/images`, `public/gifs`, `public/video`
|
|
||||||
placeholder هستند. برای جایگزینی، فایل جدید را با همان نام/مسیر جایگزین کنید یا مسیر را در
|
|
||||||
`data/content.js` تغییر دهید.
|
|
||||||
|
|
||||||
## اتصال درگاه پرداخت
|
|
||||||
در `components/CartDrawer.jsx` داخل `handleCheckout` بلوک `// TODO: Connect to payment gateway API`
|
|
||||||
با نمونهکد axios کامنتشده وجود دارد.
|
|
||||||
|
|||||||
@@ -0,0 +1,8 @@
|
|||||||
|
import type {Metadata} from 'next';
|
||||||
|
import CartPage from '@/components/CartPage';
|
||||||
|
|
||||||
|
export const metadata: Metadata = {title: 'سبد خرید | روبات مارکت'};
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return <CartPage/>;
|
||||||
|
}
|
||||||
@@ -1,13 +1,23 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import type {Dispatch, SetStateAction, ReactNode} from 'react';
|
||||||
|
import type {Locale, SiteContent, Direction} from '@/types/domain';
|
||||||
import {createContext, useContext, useEffect, useState} from 'react';
|
import {createContext, useContext, useEffect, useState} from 'react';
|
||||||
import {content} from '@/data/content';
|
import {content} from '@/data/content';
|
||||||
|
|
||||||
const LanguageContext = createContext(null);
|
interface LanguageContextValue {
|
||||||
|
locale: Locale;
|
||||||
|
setLocale: Dispatch<SetStateAction<Locale>>;
|
||||||
|
toggleLocale: () => void;
|
||||||
|
t: SiteContent;
|
||||||
|
dir: Direction;
|
||||||
|
mounted: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export function LanguageProvider({children}) {
|
const LanguageContext = createContext<LanguageContextValue | null>(null);
|
||||||
const [locale, setLocale] = useState('fa');
|
|
||||||
|
export function LanguageProvider({children}: {children: ReactNode}) {
|
||||||
|
const [locale, setLocale] = useState<Locale>('fa');
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -1,12 +1,21 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
import type {Dispatch, SetStateAction, ReactNode} from 'react';
|
||||||
|
import type {Theme} from '@/types/domain';
|
||||||
import {createContext, useContext, useEffect, useState} from 'react';
|
import {createContext, useContext, useEffect, useState} from 'react';
|
||||||
|
|
||||||
const ThemeContext = createContext(null);
|
interface ThemeContextValue {
|
||||||
|
theme: Theme;
|
||||||
|
setTheme: Dispatch<SetStateAction<Theme>>;
|
||||||
|
toggleTheme: () => void;
|
||||||
|
mounted: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
export function ThemeProvider({children}) {
|
const ThemeContext = createContext<ThemeContextValue | null>(null);
|
||||||
|
|
||||||
const [theme, setTheme] = useState('light');
|
export function ThemeProvider({children}: {children: ReactNode}) {
|
||||||
|
|
||||||
|
const [theme, setTheme] = useState<Theme>('light');
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
|
|
||||||
|
|
||||||
@@ -42,4 +51,3 @@ export function useTheme() {
|
|||||||
if (!ctx) throw new Error('useTheme must be used within ThemeProvider');
|
if (!ctx) throw new Error('useTheme must be used within ThemeProvider');
|
||||||
return ctx;
|
return ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -219,35 +219,3 @@ html[dir='rtl'] body {
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
|
||||||
/* نوار لوگوی بیپایان (trusted-by marquee) */
|
|
||||||
/* ------------------------------------------------------------------ */
|
|
||||||
@keyframes marqueeScroll {
|
|
||||||
from {
|
|
||||||
transform: translateX(0);
|
|
||||||
}
|
|
||||||
to {
|
|
||||||
transform: translateX(-50%);
|
|
||||||
}
|
|
||||||
/* دقیقاً نصف عرض، چون لیست دو برابر شده */
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-marquee {
|
|
||||||
animation: marqueeScroll 28s linear infinite;
|
|
||||||
}
|
|
||||||
|
|
||||||
.animate-marquee:hover {
|
|
||||||
animation-play-state: paused;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------------ */
|
|
||||||
/* Chat widget */
|
|
||||||
/* ------------------------------------------------------------------ */
|
|
||||||
.chat-bubble {
|
|
||||||
max-width: 80%;
|
|
||||||
padding: 10px 14px;
|
|
||||||
border-radius: 14px;
|
|
||||||
font-size: 0.875rem;
|
|
||||||
line-height: 1.6;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -1,6 +1,11 @@
|
|||||||
|
import type {Metadata, Viewport} from 'next';
|
||||||
|
import type {ReactNode} from 'react';
|
||||||
import {Vazirmatn} from 'next/font/google';
|
import {Vazirmatn} from 'next/font/google';
|
||||||
import './globals.css';
|
import './globals.css';
|
||||||
import Providers from './providers';
|
import Providers from './providers';
|
||||||
|
import Header from '@/components/Header';
|
||||||
|
import Footer from '@/components/Footer';
|
||||||
|
import DevelopmentNotice from '@/components/DevelopmentNotice';
|
||||||
|
|
||||||
const vazirmatn = Vazirmatn({
|
const vazirmatn = Vazirmatn({
|
||||||
subsets: ['arabic'],
|
subsets: ['arabic'],
|
||||||
@@ -9,24 +14,29 @@ const vazirmatn = Vazirmatn({
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
export const metadata = {
|
export const metadata: Metadata = {
|
||||||
title: 'روبات مارکت | دستگاههای وندینگ هوشمند',
|
title: 'روبات مارکت | دستگاههای وندینگ هوشمند',
|
||||||
description:
|
description:
|
||||||
'روبات مارکت؛ دستگاههای فروش خودکار هوشمند با مدیریت آنلاین، تحویل نرم و طراحی مدرن.',
|
'روبات مارکت؛ دستگاههای فروش خودکار هوشمند با مدیریت آنلاین، تحویل نرم و طراحی مدرن.',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export const viewport = {
|
export const viewport: Viewport = {
|
||||||
themeColor: '#00a693',
|
themeColor: '#00a693',
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export default function RootLayout({children}) {
|
export default function RootLayout({children}: {children: ReactNode}) {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<html lang="fa" dir="rtl" className={`${vazirmatn.variable} light`} suppressHydrationWarning>
|
<html lang="fa" dir="rtl" className={`${vazirmatn.variable} light`} suppressHydrationWarning>
|
||||||
<body className="bg-page text-primary antialiased transition-colors duration-300">
|
<body className="bg-page text-primary antialiased transition-colors duration-300">
|
||||||
<Providers>{children}</Providers>
|
<Providers>
|
||||||
|
<Header/>
|
||||||
|
{children}
|
||||||
|
<Footer/>
|
||||||
|
<DevelopmentNotice/>
|
||||||
|
</Providers>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
);
|
);
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
import Header from '@/components/Header';
|
|
||||||
import HeroSection from '@/components/HeroSection';
|
|
||||||
import TrustedBySection from '@/components/TrustedBySection';
|
|
||||||
import FeaturesSection from '@/components/FeaturesSection';
|
|
||||||
import AboutSection from '@/components/AboutSection';
|
|
||||||
import CatalogSection from '@/components/CatalogSection';
|
|
||||||
import LocationsSection from '@/components/LocationsSection';
|
|
||||||
import IntroVideoSection from '@/components/IntroVideoSection';
|
|
||||||
import MapSection from '@/components/MapSection';
|
|
||||||
import TicketForm from '@/components/TicketForm';
|
|
||||||
import Footer from '@/components/Footer';
|
|
||||||
import CartDrawer from '@/components/CartDrawer';
|
|
||||||
import ChatWidget from '@/components/ChatWidget';
|
|
||||||
import ShowcaseSection from "@/components/ShowcaseSection";
|
|
||||||
|
|
||||||
|
|
||||||
export default function HomePage() {
|
|
||||||
return (
|
|
||||||
<main className="relative bg-page">
|
|
||||||
<Header/>
|
|
||||||
|
|
||||||
<CartDrawer/>
|
|
||||||
|
|
||||||
{/*faz 1*/}
|
|
||||||
{/*<ChatWidget/>*/}
|
|
||||||
|
|
||||||
<HeroSection/>
|
|
||||||
|
|
||||||
<ShowcaseSection/>
|
|
||||||
|
|
||||||
{/*<TrustedBySection/>*/}
|
|
||||||
|
|
||||||
<FeaturesSection/>
|
|
||||||
|
|
||||||
<AboutSection/>
|
|
||||||
|
|
||||||
{/*<CatalogSection/>*/}
|
|
||||||
|
|
||||||
<LocationsSection/>
|
|
||||||
|
|
||||||
{/*<IntroVideoSection/>*/}
|
|
||||||
|
|
||||||
{/*<MapSection/>*/}
|
|
||||||
|
|
||||||
{/*<TicketForm/>*/}
|
|
||||||
|
|
||||||
<Footer/>
|
|
||||||
</main>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import LocationsSection from '@/components/LocationsSection';
|
||||||
|
import ShowcaseSection from "@/components/ShowcaseSection";
|
||||||
|
import FeaturesSection from '@/components/FeaturesSection';
|
||||||
|
import AboutSection from '@/components/AboutSection';
|
||||||
|
import HeroSection from '@/components/HeroSection';
|
||||||
|
|
||||||
|
export default function HomePage() {
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="relative bg-page">
|
||||||
|
<HeroSection/>
|
||||||
|
<ShowcaseSection/>
|
||||||
|
<FeaturesSection/>
|
||||||
|
<AboutSection/>
|
||||||
|
<LocationsSection/>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
import type {Metadata} from 'next';
|
||||||
|
import {notFound} from 'next/navigation';
|
||||||
|
import {content} from '@/data/content';
|
||||||
|
import ProductDetails from '@/components/ProductDetails';
|
||||||
|
|
||||||
|
type Props = { params: { id: string } };
|
||||||
|
|
||||||
|
export function generateStaticParams() {
|
||||||
|
return content.fa.machines.map(machine => ({id: machine.id}));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function generateMetadata({params}: Props): Metadata {
|
||||||
|
const machine = content.fa.machines.find(item => item.id === params.id);
|
||||||
|
if (!machine) return {};
|
||||||
|
return {title: `${machine.name} | روبات مارکت`, description: machine.description};
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function ProductPage({params}: Props) {
|
||||||
|
if (!content.fa.machines.some(machine => machine.id === params.id)) notFound();
|
||||||
|
return <ProductDetails id={params.id}/>;
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
import {Suspense} from 'react';
|
||||||
|
import type {Metadata} from 'next';
|
||||||
|
import ProductsPage from '@/components/ProductsPage';
|
||||||
|
|
||||||
|
export const metadata: Metadata = {title: 'همه محصولات | روبات مارکت'};
|
||||||
|
|
||||||
|
export default function Page() {
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<div className="min-h-screen pt-28 px-6" aria-busy="true"><div className="h-60 rounded-3xl bg-surface animate-pulse"/></div>}>
|
||||||
|
<ProductsPage/>
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,20 +1,23 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// پل ارتباطی بین Redux، حالت تیره/روشن، و زبان فا/en با تنظیمات ConfigProvider آنتدیزاین.
|
import type {ReactNode} from 'react';
|
||||||
|
// Connect Redux, language, and theme settings to Ant Design.
|
||||||
|
|
||||||
import {Provider as ReduxProvider} from 'react-redux';
|
import {Provider as ReduxProvider} from 'react-redux';
|
||||||
|
import type {ThemeConfig} from 'antd';
|
||||||
import {ConfigProvider, theme as antdThemeApi} from 'antd';
|
import {ConfigProvider, theme as antdThemeApi} from 'antd';
|
||||||
import faIR from 'antd/locale/fa_IR';
|
import faIR from 'antd/locale/fa_IR';
|
||||||
import enUS from 'antd/locale/en_US';
|
import enUS from 'antd/locale/en_US';
|
||||||
import {store} from '@/store/store';
|
import {store} from '@/store/store';
|
||||||
import {ThemeProvider, useTheme} from './context/ThemeContext';
|
import {ThemeProvider, useTheme} from './context/ThemeContext';
|
||||||
import {LanguageProvider, useLanguage} from './context/LanguageContext';
|
import {LanguageProvider, useLanguage} from './context/LanguageContext';
|
||||||
|
import CartPersistence from '@/components/CartPersistence';
|
||||||
|
|
||||||
function AntdBridge({children}) {
|
function AntdBridge({children}: {children: ReactNode}) {
|
||||||
const {theme} = useTheme();
|
const {theme} = useTheme();
|
||||||
const {locale, dir} = useLanguage();
|
const {locale, dir} = useLanguage();
|
||||||
|
|
||||||
const antdTheme = {
|
const antdTheme: ThemeConfig = {
|
||||||
algorithm: theme === 'dark' ? antdThemeApi.darkAlgorithm : antdThemeApi.defaultAlgorithm,
|
algorithm: theme === 'dark' ? antdThemeApi.darkAlgorithm : antdThemeApi.defaultAlgorithm,
|
||||||
token: {
|
token: {
|
||||||
colorPrimary: '#00a693',
|
colorPrimary: '#00a693',
|
||||||
@@ -35,9 +38,6 @@ function AntdBridge({children}) {
|
|||||||
headerBg: theme === 'dark' ? '#0c2b24' : '#ffffff',
|
headerBg: theme === 'dark' ? '#0c2b24' : '#ffffff',
|
||||||
titleColor: theme === 'dark' ? '#e6f7f4' : '#04231f',
|
titleColor: theme === 'dark' ? '#e6f7f4' : '#04231f',
|
||||||
},
|
},
|
||||||
Drawer: {
|
|
||||||
colorBgElevated: theme === 'dark' ? '#0c2b24' : '#ffffff',
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -48,9 +48,10 @@ function AntdBridge({children}) {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Providers({children}) {
|
export default function Providers({children}: {children: ReactNode}) {
|
||||||
return (
|
return (
|
||||||
<ReduxProvider store={store}>
|
<ReduxProvider store={store}>
|
||||||
|
<CartPersistence/>
|
||||||
<ThemeProvider>
|
<ThemeProvider>
|
||||||
<LanguageProvider>
|
<LanguageProvider>
|
||||||
<AntdBridge>{children}</AntdBridge>
|
<AntdBridge>{children}</AntdBridge>
|
||||||
@@ -1,13 +1,13 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// سکشن معرفی شرکت با متن بلند؛ بهخاطر طولانی بودن متن، یک دکمه «ادامه مطلب» برای باز/بسته کردن دارد.
|
// Company introduction with optional expandable paragraphs.
|
||||||
|
|
||||||
import {useState} from 'react';
|
import {useState} from 'react';
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
|
||||||
export default function AboutSection() {
|
export default function AboutSection() {
|
||||||
const {t} = useLanguage();
|
const {t} = useLanguage();
|
||||||
const [expanded, setExpanded] = useState(true);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const visibleParagraphs = expanded ? t.about.paragraphs : t.about.paragraphs.slice(0, 2);
|
const visibleParagraphs = expanded ? t.about.paragraphs : t.about.paragraphs.slice(0, 2);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -26,14 +26,13 @@ export default function AboutSection() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* faz 1 */}
|
<button
|
||||||
{/* <button
|
|
||||||
onClick={() => setExpanded((v) => !v)}
|
onClick={() => setExpanded((v) => !v)}
|
||||||
className="mt-6 inline-flex items-center gap-2 text-brand-400 hover:text-brand-300 text-sm font-semibold transition-colors"
|
className="mt-6 inline-flex items-center gap-2 text-brand-400 hover:text-brand-300 text-sm font-semibold transition-colors"
|
||||||
>
|
>
|
||||||
{expanded ? t.about.less : t.about.more}
|
{expanded ? t.about.less : t.about.more}
|
||||||
<span className={`transition-transform ${expanded ? 'rotate-180' : ''}`}>˅</span>
|
<span className={`transition-transform ${expanded ? 'rotate-180' : ''}`}>˅</span>
|
||||||
</button>*/}
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// کشوی (Drawer) سبد خرید: نمایش آیتمهای انتخابی، تغییر تعداد، جمع کل، و دکمه پرداخت (placeholder).
|
|
||||||
|
|
||||||
import {Drawer, Button, Empty, InputNumber, message} from 'antd';
|
|
||||||
import {DeleteOutlined} from '@ant-design/icons';
|
|
||||||
import {useSelector, useDispatch} from 'react-redux';
|
|
||||||
import {
|
|
||||||
selectCartItems,
|
|
||||||
selectCartTotal,
|
|
||||||
selectIsDrawerOpen,
|
|
||||||
closeDrawer,
|
|
||||||
removeFromCart,
|
|
||||||
incrementQty,
|
|
||||||
decrementQty,
|
|
||||||
} from '@/store/cartSlice';
|
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
|
||||||
import api from "@/lib/axios";
|
|
||||||
|
|
||||||
function toLocaleNumber(n, locale) {
|
|
||||||
return n.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US');
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CartDrawer() {
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const isOpen = useSelector(selectIsDrawerOpen);
|
|
||||||
const items = useSelector(selectCartItems);
|
|
||||||
const total = useSelector(selectCartTotal);
|
|
||||||
const {t, locale, dir} = useLanguage();
|
|
||||||
|
|
||||||
const currencySuffix = locale === 'fa' ? ' ریال' : ' Rials';
|
|
||||||
|
|
||||||
const handleCheckout = async () => {
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// TODO: Connect to payment gateway API.
|
|
||||||
|
|
||||||
// try {
|
|
||||||
// const { data } = await axios.post('/api/payment/create', {
|
|
||||||
// items: items.map((i) => ({ id: i.id, qty: i.qty })),
|
|
||||||
// totalAmount: total,
|
|
||||||
// });
|
|
||||||
// window.location.href = data.paymentRedirectUrl;
|
|
||||||
// } catch (err) {
|
|
||||||
// message.error('...');
|
|
||||||
// }
|
|
||||||
|
|
||||||
// api() <===> todo : use this func to fetch ...
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
await message.info(t.cart.checkoutToast);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Drawer
|
|
||||||
title={t.cart.title}
|
|
||||||
placement={dir === 'rtl' ? 'right' : 'left'}
|
|
||||||
onClose={() => dispatch(closeDrawer())}
|
|
||||||
open={isOpen}
|
|
||||||
width={400}
|
|
||||||
>
|
|
||||||
{items.length === 0 ? (
|
|
||||||
<Empty description={<span className="text-secondary">{t.cart.empty}</span>} className="mt-16"/>
|
|
||||||
) : (
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
{items.map((item) => (
|
|
||||||
<div key={item.id}
|
|
||||||
className="flex items-center gap-3 bg-surface border border-subtle rounded-xl p-3">
|
|
||||||
<img src={item.image} alt={item.name} className="w-14 h-20 object-contain shrink-0"/>
|
|
||||||
<div className="flex-1 min-w-0">
|
|
||||||
<p className="text-sm font-semibold text-primary truncate">{item.name}</p>
|
|
||||||
<p className="text-xs text-brand-400 mt-1">
|
|
||||||
{toLocaleNumber(item.priceNumeric, locale)}
|
|
||||||
{currencySuffix}
|
|
||||||
</p>
|
|
||||||
<div className="flex items-center gap-2 mt-2">
|
|
||||||
<InputNumber
|
|
||||||
size="small"
|
|
||||||
min={1}
|
|
||||||
value={item.qty}
|
|
||||||
onChange={(val) => {
|
|
||||||
if (val > item.qty) dispatch(incrementQty(item.id));
|
|
||||||
else if (val < item.qty) dispatch(decrementQty(item.id));
|
|
||||||
}}
|
|
||||||
className="w-16"
|
|
||||||
/>
|
|
||||||
<Button
|
|
||||||
type="text"
|
|
||||||
danger
|
|
||||||
size="small"
|
|
||||||
icon={<DeleteOutlined/>}
|
|
||||||
onClick={() => dispatch(removeFromCart(item.id))}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
|
|
||||||
<div className="border-t border-subtle pt-4 mt-2">
|
|
||||||
<div className="flex items-center justify-between text-sm text-secondary mb-4">
|
|
||||||
<span>{t.cart.total}</span>
|
|
||||||
<span className="text-lg font-bold text-primary">
|
|
||||||
{toLocaleNumber(total, locale)}
|
|
||||||
{currencySuffix}
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
<Button type="primary" block size="large" onClick={handleCheckout}>
|
|
||||||
{t.cart.checkout}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Drawer>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {Button, Empty} from 'antd';
|
||||||
|
import {DeleteOutlined} from '@ant-design/icons';
|
||||||
|
import {useAppDispatch, useAppSelector} from '@/store/hooks';
|
||||||
|
import {removeFromCart, selectCartItems, selectCartTotal} from '@/store/cartSlice';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import QuantityControl from './QuantityControl';
|
||||||
|
|
||||||
|
export default function CartPage() {
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
const items = useAppSelector(selectCartItems);
|
||||||
|
const total = useAppSelector(selectCartTotal);
|
||||||
|
const {t, locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
const money = (value: number) => `${value.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US')} ${copy.currency}`;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="mx-auto max-w-7xl min-h-[65vh] px-5 md:px-8 pt-28 pb-20">
|
||||||
|
<Link href="/products" className="text-brand-400 hover:underline">{copy.continueShopping}</Link>
|
||||||
|
<h1 className="text-3xl md:text-4xl font-extrabold text-primary mt-6">{t.cart.title}</h1>
|
||||||
|
<p className="text-secondary mt-3 mb-10">{copy.cartDescription}</p>
|
||||||
|
{items.length === 0 ? (
|
||||||
|
<div className="rounded-3xl border border-subtle bg-surface p-10 text-center">
|
||||||
|
<Empty description={t.cart.empty}/>
|
||||||
|
<Link href="/products" className="inline-block mt-6 text-brand-400 hover:underline">{copy.continueShopping}</Link>
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="grid lg:grid-cols-[minmax(0,1fr),340px] gap-8 items-start">
|
||||||
|
<div className="space-y-4">
|
||||||
|
{items.map(item => {
|
||||||
|
const product = t.machines.find(machine => machine.id === item.id) ?? item;
|
||||||
|
return (
|
||||||
|
<article key={item.id} className="rounded-2xl border border-subtle bg-surface p-5 flex flex-wrap sm:flex-nowrap gap-5 items-center">
|
||||||
|
<Link href={`/products/${item.id}`} className="shrink-0">
|
||||||
|
<img src={product.image} alt={product.name} className="w-24 h-32 object-contain"/>
|
||||||
|
</Link>
|
||||||
|
<div className="flex-1 min-w-0">
|
||||||
|
<Link href={`/products/${item.id}`} className="font-bold text-lg text-primary hover:text-brand-400">{product.name}</Link>
|
||||||
|
<p className="text-secondary text-sm mt-2">{copy.unitPrice}: {money(item.priceNumeric)}</p>
|
||||||
|
<div className="flex flex-wrap gap-3 items-center mt-4">
|
||||||
|
<QuantityControl product={product}/>
|
||||||
|
<Button danger type="text" icon={<DeleteOutlined/>}
|
||||||
|
aria-label={`${copy.remove}: ${product.name}`}
|
||||||
|
onClick={() => dispatch(removeFromCart(item.id))}/>
|
||||||
|
</div>
|
||||||
|
<p className="mt-4 text-primary font-semibold">{copy.lineTotal}: {money(item.qty * item.priceNumeric)}</p>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
<aside className="lg:sticky lg:top-28 border border-subtle bg-elevated rounded-2xl p-6">
|
||||||
|
<h2 className="font-bold text-xl text-primary">{copy.summary}</h2>
|
||||||
|
<div className="border-t border-subtle mt-5 pt-5 flex flex-wrap justify-between gap-3">
|
||||||
|
<span className="text-secondary">{t.cart.total}</span>
|
||||||
|
<strong className="text-primary">{money(total)}</strong>
|
||||||
|
</div>
|
||||||
|
<p className="text-secondary text-sm leading-7 my-5">{copy.checkoutUnavailable}</p>
|
||||||
|
<Button type="primary" size="large" disabled block>{t.cart.checkout}</Button>
|
||||||
|
</aside>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import {useEffect} from 'react';
|
||||||
|
import {useStore} from 'react-redux';
|
||||||
|
import type {AppStore} from '@/store/store';
|
||||||
|
import type {CartItem} from '@/types/domain';
|
||||||
|
import {restoreCart} from '@/store/cartSlice';
|
||||||
|
import {content} from '@/data/content';
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'rm-cart';
|
||||||
|
const useAppStore = useStore.withTypes<AppStore>();
|
||||||
|
|
||||||
|
export default function CartPersistence() {
|
||||||
|
const store = useAppStore();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
const saved: unknown = JSON.parse(localStorage.getItem(STORAGE_KEY) ?? '[]');
|
||||||
|
if (Array.isArray(saved)) {
|
||||||
|
const items: CartItem[] = [];
|
||||||
|
for (const entry of saved) {
|
||||||
|
if (!entry || typeof entry !== 'object' || typeof entry.id !== 'string'
|
||||||
|
|| !Number.isSafeInteger(entry.qty) || entry.qty < 1) continue;
|
||||||
|
const machine = content.fa.machines.find(item => item.id === entry.id);
|
||||||
|
if (!machine || items.some(item => item.id === machine.id)) continue;
|
||||||
|
// Restore identifiers and quantities; use current catalog prices and images.
|
||||||
|
items.push({id: machine.id, name: machine.name, image: machine.image,
|
||||||
|
priceNumeric: machine.priceNumeric, priceLabel: machine.priceLabel, qty: entry.qty});
|
||||||
|
}
|
||||||
|
store.dispatch(restoreCart(items));
|
||||||
|
}
|
||||||
|
} catch {
|
||||||
|
// Invalid or unavailable storage must not prevent shopping.
|
||||||
|
}
|
||||||
|
|
||||||
|
return store.subscribe(() => {
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, JSON.stringify(store.getState().cart.items.map(({id, qty}) => ({id, qty}))));
|
||||||
|
} catch {
|
||||||
|
// Keep the in-memory cart usable when storage is full or disabled.
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}, [store]);
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// کاتالوگ محصولات جانبی (زعفران، تنقلات، نوشیدنی و ...) که مشتریان دستگاه با قیمت کمتر از بازار
|
|
||||||
// میتوانند سفارش دهند. دکمه «افزودن به سفارش» از همان سبد خرید Redux دستگاهها استفاده میکند.
|
|
||||||
|
|
||||||
import { Button, message } from 'antd';
|
|
||||||
import { PlusOutlined } from '@ant-design/icons';
|
|
||||||
import { useDispatch } from 'react-redux';
|
|
||||||
import { addToCart } from '@/store/cartSlice';
|
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
|
||||||
|
|
||||||
function toLocaleNumber(n, locale) {
|
|
||||||
return n.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US');
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function CatalogSection() {
|
|
||||||
const { t, locale } = useLanguage();
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const currencySuffix = locale === 'fa' ? ' ریال' : ' Rials';
|
|
||||||
|
|
||||||
const handleAdd = (item) => {
|
|
||||||
dispatch(
|
|
||||||
addToCart({
|
|
||||||
id: `catalog-${item.id}`,
|
|
||||||
name: item.name,
|
|
||||||
priceNumeric: item.priceNumeric,
|
|
||||||
priceLabel: `${toLocaleNumber(item.priceNumeric, locale)}${currencySuffix}`,
|
|
||||||
image: item.image,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
message.success(t.catalog.addToast(item.name));
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section id="catalog" className="relative px-6 md:px-16 py-20 md:py-28 bg-page border-t border-subtle">
|
|
||||||
<div className="max-w-6xl mx-auto">
|
|
||||||
<div className="text-center mb-4">
|
|
||||||
<span className="text-brand-400 text-sm font-semibold tracking-wide">{t.catalog.eyebrow}</span>
|
|
||||||
<h2 className="text-2xl md:text-4xl font-extrabold brand-gradient-text mt-3">{t.catalog.title}</h2>
|
|
||||||
</div>
|
|
||||||
<p className="text-secondary text-sm md:text-base text-center max-w-2xl mx-auto mb-12">
|
|
||||||
{t.catalog.subtitle}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-5">
|
|
||||||
{t.catalog.items.map((item) => (
|
|
||||||
<div
|
|
||||||
key={item.id}
|
|
||||||
className="bg-surface border border-subtle rounded-2xl p-5 flex flex-col hover:border-brand-500/60 transition-colors"
|
|
||||||
>
|
|
||||||
<div className="flex items-center gap-4 mb-4">
|
|
||||||
<img src={item.image} alt={item.name} className="w-16 h-16 object-contain shrink-0" />
|
|
||||||
<div className="min-w-0">
|
|
||||||
<span className="text-[11px] text-brand-400 font-semibold">{item.category}</span>
|
|
||||||
<h3 className="text-primary font-bold text-sm leading-6">{item.name}</h3>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="mt-auto flex items-end justify-between gap-2">
|
|
||||||
<div>
|
|
||||||
<p className="text-xs text-secondary line-through opacity-70">
|
|
||||||
{toLocaleNumber(item.originalPriceNumeric, locale)}
|
|
||||||
{currencySuffix}
|
|
||||||
</p>
|
|
||||||
<p className="text-base font-bold text-primary">
|
|
||||||
{toLocaleNumber(item.priceNumeric, locale)}
|
|
||||||
{currencySuffix}
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="middle"
|
|
||||||
icon={<PlusOutlined />}
|
|
||||||
onClick={() => handleAdd(item)}
|
|
||||||
>
|
|
||||||
{t.catalog.addToOrder}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// آیکون شناور چت گوشه صفحه؛ با کلیک یک مودال گفتگوی ساده باز میشود (فعلاً بدون اتصال به بکاند واقعی).
|
|
||||||
|
|
||||||
import { useEffect, useRef, useState } from 'react';
|
|
||||||
import { Modal, Input, Button, Tooltip } from 'antd';
|
|
||||||
import { MessageOutlined, SendOutlined, CloseOutlined } from '@ant-design/icons';
|
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
|
||||||
|
|
||||||
export default function ChatWidget() {
|
|
||||||
const { t, dir } = useLanguage();
|
|
||||||
const [open, setOpen] = useState(false);
|
|
||||||
const [draft, setDraft] = useState('');
|
|
||||||
const [messages, setMessages] = useState([]);
|
|
||||||
const scrollRef = useRef(null);
|
|
||||||
|
|
||||||
// Seed the bot greeting once, in the current language.
|
|
||||||
useEffect(() => {
|
|
||||||
setMessages([{ from: 'bot', text: t.chat.initialBotMessage }]);
|
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
||||||
}, [t.chat.initialBotMessage]);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
scrollRef.current?.scrollTo({ top: scrollRef.current.scrollHeight, behavior: 'smooth' });
|
|
||||||
}, [messages, open]);
|
|
||||||
|
|
||||||
const handleSend = () => {
|
|
||||||
const text = draft.trim();
|
|
||||||
if (!text) return;
|
|
||||||
|
|
||||||
setMessages((prev) => [...prev, { from: 'user', text }]);
|
|
||||||
setDraft('');
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
// TODO: Connect to a real chat/support backend (e.g. via axios or a
|
|
||||||
// websocket) instead of this local placeholder reply.
|
|
||||||
//
|
|
||||||
// import axios from 'axios';
|
|
||||||
// const { data } = await axios.post('/api/chat', { message: text });
|
|
||||||
// setMessages((prev) => [...prev, { from: 'bot', text: data.reply }]);
|
|
||||||
// api() <===> todo : use this func to fetch ...
|
|
||||||
|
|
||||||
// -----------------------------------------------------------------
|
|
||||||
setTimeout(() => {
|
|
||||||
setMessages((prev) => [...prev, { from: 'bot', text: t.chat.fallbackReply }]);
|
|
||||||
}, 600);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<>
|
|
||||||
<Tooltip title={t.chat.fabLabel} placement="left">
|
|
||||||
<button
|
|
||||||
onClick={() => setOpen(true)}
|
|
||||||
aria-label={t.chat.fabLabel}
|
|
||||||
className="fixed bottom-6 z-40 w-14 h-14 rounded-full bg-brand hover:bg-brand-400 text-ink-950 shadow-brandGlow flex items-center justify-center text-2xl transition-transform hover:scale-105"
|
|
||||||
style={dir === 'rtl' ? { left: '1.5rem' } : { right: '1.5rem' }}
|
|
||||||
>
|
|
||||||
<MessageOutlined />
|
|
||||||
</button>
|
|
||||||
</Tooltip>
|
|
||||||
|
|
||||||
<Modal
|
|
||||||
open={open}
|
|
||||||
onCancel={() => setOpen(false)}
|
|
||||||
footer={null}
|
|
||||||
closeIcon={<CloseOutlined />}
|
|
||||||
title={t.chat.title}
|
|
||||||
centered
|
|
||||||
>
|
|
||||||
<div
|
|
||||||
ref={scrollRef}
|
|
||||||
className="flex flex-col gap-3 h-80 overflow-y-auto py-2 px-1"
|
|
||||||
>
|
|
||||||
{messages.map((m, i) => (
|
|
||||||
<div
|
|
||||||
key={i}
|
|
||||||
className={`chat-bubble ${
|
|
||||||
m.from === 'user'
|
|
||||||
? 'self-end bg-brand text-ink-950'
|
|
||||||
: 'self-start bg-surface-strong text-primary'
|
|
||||||
}`}
|
|
||||||
>
|
|
||||||
{m.text}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex items-center gap-2 mt-3 border-t border-subtle pt-3">
|
|
||||||
<Input
|
|
||||||
size="large"
|
|
||||||
value={draft}
|
|
||||||
onChange={(e) => setDraft(e.target.value)}
|
|
||||||
onPressEnter={handleSend}
|
|
||||||
placeholder={t.chat.placeholder}
|
|
||||||
/>
|
|
||||||
<Button type="primary" size="large" icon={<SendOutlined />} onClick={handleSend}>
|
|
||||||
{t.chat.send}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</Modal>
|
|
||||||
</>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import {useEffect, useState} from 'react';
|
||||||
|
import {Button, Modal} from 'antd';
|
||||||
|
import {ToolOutlined} from '@ant-design/icons';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
|
||||||
|
const STORAGE_KEY = 'rm-development-notice-seen';
|
||||||
|
|
||||||
|
export default function DevelopmentNotice() {
|
||||||
|
const [open, setOpen] = useState(false);
|
||||||
|
const {locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
try {
|
||||||
|
setOpen(localStorage.getItem(STORAGE_KEY) !== 'true');
|
||||||
|
} catch {
|
||||||
|
// Show the notice even when browser storage is unavailable.
|
||||||
|
setOpen(true);
|
||||||
|
}
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const dismiss = () => {
|
||||||
|
setOpen(false);
|
||||||
|
try {
|
||||||
|
localStorage.setItem(STORAGE_KEY, 'true');
|
||||||
|
} catch {
|
||||||
|
// Dismissing the notice must not depend on storage access.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Modal open={open} centered title={copy.developmentTitle} onCancel={dismiss}
|
||||||
|
footer={<Button type="primary" onClick={dismiss}>{copy.acknowledge}</Button>}>
|
||||||
|
<ToolOutlined className="text-brand-400 text-3xl my-4"/>
|
||||||
|
<p className="text-secondary leading-8">{copy.developmentMessage}</p>
|
||||||
|
</Modal>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// نوار مزایا: ضمانت کالا، مشاوره رایگان، خرید اقساطی، بستهبندی ایمن.
|
// Service benefits: warranty, consultation, installments, and packaging.
|
||||||
|
|
||||||
import {
|
import {
|
||||||
SafetyCertificateOutlined,
|
SafetyCertificateOutlined,
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// رندر آیتمهای شناور (چیپس/نوشابه) دور دستگاه با حرکت تصادفی و ملایم GSAP.
|
// Animate decorative snack images with gentle randomized motion.
|
||||||
|
|
||||||
|
import type {FloatingSnack} from '@/types/domain';
|
||||||
import {useEffect, useRef} from 'react';
|
import {useEffect, useRef} from 'react';
|
||||||
import {gsap} from 'gsap';
|
import {gsap} from 'gsap';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Renders the centralized `floatingSnacks` config as absolutely-positioned
|
* Renders the centralized `floatingSnacks` config as absolutely-positioned
|
||||||
* images and gives each one a gentle, randomized floating drift via GSAP.
|
* images and gives each one a gentle, randomized floating drift via GSAP.
|
||||||
* Positions/sizes/images all come from data/content.js — edit there only.
|
* Positions/sizes/images all come from data/content.ts — edit there only.
|
||||||
*/
|
*/
|
||||||
export default function FloatingItems({items}) {
|
export default function FloatingItems({items}: {items: FloatingSnack[]}) {
|
||||||
const containerRef = useRef(null);
|
const containerRef = useRef<HTMLDivElement>(null);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const nodes = containerRef.current?.querySelectorAll('[data-float-item]');
|
const nodes = containerRef.current?.querySelectorAll('[data-float-item]');
|
||||||
@@ -1,12 +1,14 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// فوتر سایت: درباره ما کوتاه، لینکهای شبکه اجتماعی، دسترسی سریع، و اطلاعات تماس/آدرس.
|
// Company information, quick links, social links, and contact details.
|
||||||
|
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import Link from 'next/link';
|
||||||
import { PhoneOutlined, EnvironmentOutlined } from '@ant-design/icons';
|
import { PhoneOutlined, EnvironmentOutlined } from '@ant-design/icons';
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
import { useLanguage } from '@/app/context/LanguageContext';
|
||||||
|
|
||||||
export default function Footer() {
|
export default function Footer() {
|
||||||
const { t } = useLanguage();
|
const { t, locale } = useLanguage();
|
||||||
const c = t.contactInfo;
|
const c = t.contactInfo;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -33,14 +35,10 @@ export default function Footer() {
|
|||||||
<div>
|
<div>
|
||||||
<h3 className="text-primary font-bold text-lg mb-3">{t.footer.quickLinks}</h3>
|
<h3 className="text-primary font-bold text-lg mb-3">{t.footer.quickLinks}</h3>
|
||||||
<ul className="flex flex-col gap-2 text-sm text-secondary">
|
<ul className="flex flex-col gap-2 text-sm text-secondary">
|
||||||
<li><a href="#hero" className="hover:text-brand-400">{t.nav.home}</a></li>
|
<li><Link href="/#hero" className="hover:text-brand-400">{t.nav.home}</Link></li>
|
||||||
<li><a href="#showcase" className="hover:text-brand-400">{t.nav.showcase}</a></li>
|
<li><Link href="/products" className="hover:text-brand-400">{commerceCopy[locale].allProducts}</Link></li>
|
||||||
<li><a href="#about" className="hover:text-brand-400">{t.nav.about}</a></li>
|
<li><Link href="/#about" className="hover:text-brand-400">{t.nav.about}</Link></li>
|
||||||
{/*<li><a href="#catalog" className="hover:text-brand-400">{t.nav.catalog}</a></li>*/}
|
<li><Link href="/#locations" className="hover:text-brand-400">{t.nav.locations}</Link></li>
|
||||||
<li><a href="#locations" className="hover:text-brand-400">{t.nav.locations}</a></li>
|
|
||||||
{/*<li><a href="#video" className="hover:text-brand-400">{t.nav.video}</a></li>*/}
|
|
||||||
{/*<li><a href="#map" className="hover:text-brand-400">{t.nav.map}</a></li>*/}
|
|
||||||
{/*<li><a href="#support" className="hover:text-brand-400">{t.nav.support}</a></li>*/}
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -1,61 +1,66 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// هدر ثابت بالای صفحه: لوگو، منوی ناوبری، سوییچ زبان/تم، دکمه ورود به پنل کاربری و آیکون سبد خرید.
|
// Fixed navigation with language, theme, account, and cart controls.
|
||||||
|
|
||||||
import {useState, useEffect} from 'react';
|
import {useState, useEffect} from 'react';
|
||||||
import Image from 'next/image';
|
import Image from 'next/image';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {usePathname} from 'next/navigation';
|
||||||
import {Badge, Button} from 'antd';
|
import {Badge, Button} from 'antd';
|
||||||
import {ShoppingCartOutlined, MenuOutlined, CloseOutlined, UserOutlined} from '@ant-design/icons';
|
import {ShoppingCartOutlined, MenuOutlined, CloseOutlined, UserOutlined} from '@ant-design/icons';
|
||||||
import {useSelector, useDispatch} from 'react-redux';
|
import {useAppSelector} from '@/store/hooks';
|
||||||
import {selectCartCount, openDrawer} from '@/store/cartSlice';
|
import {selectCartCount} from '@/store/cartSlice';
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
import ThemeToggle from './ThemeToggle';
|
import ThemeToggle from './ThemeToggle';
|
||||||
import LanguageToggle from './LanguageToggle';
|
import LanguageToggle from './LanguageToggle';
|
||||||
|
|
||||||
export default function Header() {
|
export default function Header() {
|
||||||
const dispatch = useDispatch();
|
const pathname = usePathname();
|
||||||
const cartCount = useSelector(selectCartCount);
|
const cartCount = useAppSelector(selectCartCount);
|
||||||
const {t} = useLanguage();
|
const {t, locale} = useLanguage();
|
||||||
const [scrolled, setScrolled] = useState(false);
|
const [scrolled, setScrolled] = useState(false);
|
||||||
const [mobileOpen, setMobileOpen] = useState(false);
|
const [mobileOpen, setMobileOpen] = useState(false);
|
||||||
|
|
||||||
const navLinks = [
|
const navLinks = [
|
||||||
{href: '#hero', label: t.nav.home},
|
{href: '/#hero', label: t.nav.home},
|
||||||
{href: '#showcase', label: t.nav.showcase},
|
{href: '/products', label: commerceCopy[locale].allProducts},
|
||||||
{href: '#about', label: t.nav.about},
|
{href: '/#about', label: t.nav.about},
|
||||||
// {href: '#catalog', label: t.nav.catalog},
|
{href: '/#locations', label: t.nav.locations},
|
||||||
{href: '#locations', label: t.nav.locations},
|
|
||||||
// {href: '#video', label: t.nav.video},
|
|
||||||
// {href: '#map', label: t.nav.map},
|
|
||||||
// {href: '#support', label: t.nav.support},
|
|
||||||
];
|
];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const onScroll = () => setScrolled(window.scrollY > 24);
|
const onScroll = () => setScrolled(window.scrollY > 24);
|
||||||
|
onScroll();
|
||||||
window.addEventListener('scroll', onScroll);
|
window.addEventListener('scroll', onScroll);
|
||||||
return () => window.removeEventListener('scroll', onScroll);
|
return () => window.removeEventListener('scroll', onScroll);
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
console.log(
|
||||||
|
"%c👋 Hamed Abdollahzade · Frontend Developer",
|
||||||
|
"font-size:14px;font-weight:600;"
|
||||||
|
);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<header
|
<header
|
||||||
className={`fixed top-0 inset-x-0 z-50 transition-all duration-300 ${
|
className={`fixed top-0 inset-x-0 z-50 transition-all duration-300 ${
|
||||||
scrolled ? 'bg-page-85 backdrop-blur-md shadow-[0_1px_0_0_rgba(0,166,147,0.25)]' : 'bg-transparent'
|
scrolled || pathname !== '/' ? 'bg-page-85 backdrop-blur-md shadow-[0_1px_0_0_rgba(0,166,147,0.25)]' : 'bg-transparent'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<div className="mx-auto max-w-7xl px-5 md:px-8 h-20 flex items-center justify-between gap-4">
|
<div className="mx-auto max-w-7xl px-5 md:px-8 h-20 flex items-center justify-between gap-4">
|
||||||
<a href="#hero" className="flex items-center gap-2 shrink-0">
|
<Link href="/#hero" onClick={() => setMobileOpen(false)} className="flex items-center gap-2 shrink-0">
|
||||||
<Image src="/images/icons/logo.png" alt="روبات مارکت" width={150} height={42} priority/>
|
<Image src="/images/icons/logo.png" alt="روبات مارکت" width={150} height={42} priority/>
|
||||||
</a>
|
</Link>
|
||||||
|
|
||||||
<nav className="hidden xl:flex items-center gap-5 2xl:gap-7">
|
<nav className="hidden xl:flex items-center gap-5 2xl:gap-7">
|
||||||
{navLinks.map((link) => (
|
{navLinks.map((link) => (
|
||||||
<a
|
<Link
|
||||||
key={link.href}
|
key={link.href}
|
||||||
href={link.href}
|
href={link.href}
|
||||||
className="text-sm text-secondary hover:text-brand-300 transition-colors whitespace-nowrap"
|
className="text-sm text-secondary hover:text-brand-300 transition-colors whitespace-nowrap"
|
||||||
>
|
>
|
||||||
{link.label}
|
{link.label}
|
||||||
</a>
|
</Link>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
@@ -75,16 +80,12 @@ export default function Header() {
|
|||||||
{t.nav.login}
|
{t.nav.login}
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
{/* faz 1 */}
|
<Badge count={cartCount} size="small" offset={[-2, 2]}>
|
||||||
{/* <Badge count={cartCount} size="small" offset={[-2, 2]}>
|
<Link href="/cart" onClick={() => setMobileOpen(false)} aria-label={t.cart.title}
|
||||||
<Button
|
className="w-11 h-11 rounded-full border border-subtle bg-elevated inline-flex items-center justify-center text-xl text-primary hover:text-brand-400">
|
||||||
shape="circle"
|
<ShoppingCartOutlined/>
|
||||||
size="large"
|
</Link>
|
||||||
icon={<ShoppingCartOutlined/>}
|
</Badge>
|
||||||
onClick={() => dispatch(openDrawer())}
|
|
||||||
aria-label="cart"
|
|
||||||
/>
|
|
||||||
</Badge>*/}
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
className="xl:hidden text-brand-400 text-2xl"
|
className="xl:hidden text-brand-400 text-2xl"
|
||||||
@@ -100,19 +101,26 @@ export default function Header() {
|
|||||||
<nav
|
<nav
|
||||||
className="xl:hidden bg-elevated-95 backdrop-blur-md border-t border-subtle px-5 py-4 flex flex-col gap-4 max-h-[calc(100vh-5rem)] overflow-y-auto">
|
className="xl:hidden bg-elevated-95 backdrop-blur-md border-t border-subtle px-5 py-4 flex flex-col gap-4 max-h-[calc(100vh-5rem)] overflow-y-auto">
|
||||||
{navLinks.map((link) => (
|
{navLinks.map((link) => (
|
||||||
<a
|
<Link
|
||||||
key={link.href}
|
key={link.href}
|
||||||
href={link.href}
|
href={link.href}
|
||||||
onClick={() => setMobileOpen(false)}
|
onClick={() => setMobileOpen(false)}
|
||||||
className="text-secondary text-base"
|
className="text-secondary text-base"
|
||||||
>
|
>
|
||||||
{link.label}
|
{link.label}
|
||||||
</a>
|
</Link>
|
||||||
))}
|
))}
|
||||||
<div className="flex items-center gap-3 pt-2 border-t border-subtle">
|
<div className="flex items-center gap-3 pt-2 border-t border-subtle">
|
||||||
<LanguageToggle/>
|
<LanguageToggle/>
|
||||||
<ThemeToggle/>
|
<ThemeToggle/>
|
||||||
<Button icon={<UserOutlined/>} className="flex-1">
|
<Button
|
||||||
|
icon={<UserOutlined/>}
|
||||||
|
className="flex-1"
|
||||||
|
href="https://panel.my-rm.com"
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
onClick={() => setMobileOpen(false)}
|
||||||
|
>
|
||||||
{t.nav.login}
|
{t.nav.login}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
@@ -1,25 +1,20 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
/**
|
/** Full-width product carousel with autoplay and manual navigation. */
|
||||||
* سکشن اول سایت (Hero) — ایده کلی از صفحه وندینگ سایت Sielaff گرفته شده:
|
|
||||||
* یک اسلایدر تمامعرض که هر ۵ ثانیه بهصورت خودکار به اسلاید بعدی میرود،
|
|
||||||
* همراه با یک شکل مورب رنگی (بهجای قرمز آنها، رنگ سبز برند خودمان #00a693)،
|
|
||||||
* عنوان بزرگ دو خطی، و دکمههای فلش قبلی/بعدی برای ناوبری دستی.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {useCallback, useEffect, useRef, useState} from 'react';
|
import {useCallback, useEffect, useRef, useState} from 'react';
|
||||||
import {LeftOutlined, RightOutlined} from '@ant-design/icons';
|
import {LeftOutlined, RightOutlined} from '@ant-design/icons';
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
|
||||||
const AUTOPLAY_DELAY = 5000; // هر ۵ ثانیه اسلاید عوض میشود
|
const AUTOPLAY_DELAY = 5000; // Advance every five seconds.
|
||||||
|
|
||||||
export default function HeroSection() {
|
export default function HeroSection() {
|
||||||
const {t, dir} = useLanguage();
|
const {t, dir} = useLanguage();
|
||||||
const slides = t.hero.slides;
|
const slides = t.hero.slides;
|
||||||
const [activeIndex, setActiveIndex] = useState(0);
|
const [activeIndex, setActiveIndex] = useState(0);
|
||||||
const timerRef = useRef(null);
|
const timerRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||||
|
|
||||||
// رفتن به اسلاید بعدی (با چرخش به اول لیست وقتی به آخر رسید)
|
// Wrap around after the last slide.
|
||||||
const goToNext = useCallback(() => {
|
const goToNext = useCallback(() => {
|
||||||
setActiveIndex((prev) => (prev + 1) % slides.length);
|
setActiveIndex((prev) => (prev + 1) % slides.length);
|
||||||
}, [slides.length]);
|
}, [slides.length]);
|
||||||
@@ -28,9 +23,7 @@ export default function HeroSection() {
|
|||||||
setActiveIndex((prev) => (prev - 1 + slides.length) % slides.length);
|
setActiveIndex((prev) => (prev - 1 + slides.length) % slides.length);
|
||||||
}, [slides.length]);
|
}, [slides.length]);
|
||||||
|
|
||||||
// تایمر پخش خودکار: هر بار که اسلاید عوض میشود، تایمر قبلی پاک و یک تایمر
|
// Restart the autoplay timer after manual navigation.
|
||||||
// جدید ۵ ثانیهای ست میشود. با کلیک دستی روی فلشها هم همین تابع دوباره
|
|
||||||
// صدا زده میشود تا شمارش از نو شروع شود (تجربه کاربری بهتر).
|
|
||||||
const restartAutoplay = useCallback(() => {
|
const restartAutoplay = useCallback(() => {
|
||||||
if (timerRef.current) clearInterval(timerRef.current);
|
if (timerRef.current) clearInterval(timerRef.current);
|
||||||
timerRef.current = setInterval(goToNext, AUTOPLAY_DELAY);
|
timerRef.current = setInterval(goToNext, AUTOPLAY_DELAY);
|
||||||
@@ -43,10 +36,10 @@ export default function HeroSection() {
|
|||||||
};
|
};
|
||||||
}, [restartAutoplay]);
|
}, [restartAutoplay]);
|
||||||
|
|
||||||
const handleManualNav = (direction) => {
|
const handleManualNav = (direction: 'next' | 'prev') => {
|
||||||
if (direction === 'next') goToNext();
|
if (direction === 'next') goToNext();
|
||||||
else goToPrev();
|
else goToPrev();
|
||||||
restartAutoplay(); // شمارش ۵ ثانیه بعد از کلیک دستی از نو شروع شود
|
restartAutoplay(); // Reset the delay after a manual click.
|
||||||
};
|
};
|
||||||
|
|
||||||
const slide = slides[activeIndex];
|
const slide = slides[activeIndex];
|
||||||
@@ -54,7 +47,7 @@ export default function HeroSection() {
|
|||||||
return (
|
return (
|
||||||
<section id="hero" className="relative h-screen w-full overflow-hidden bg-page">
|
<section id="hero" className="relative h-screen w-full overflow-hidden bg-page">
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
{/* شکل مورب تزئینی سمت راست/چپ — نسخه سبز برند بهجای قرمز Sielaff */}
|
{/* Decorative brand-colored shape. */}
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
<div
|
<div
|
||||||
className="absolute inset-y-0 w-1/3 hidden md:block"
|
className="absolute inset-y-0 w-1/3 hidden md:block"
|
||||||
@@ -68,8 +61,8 @@ export default function HeroSection() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
{/* اسلایدهای عکس — همه اسلایدها روی هم قرار دارند و فقط با opacity */}
|
{/* Fade between overlapping product images. */}
|
||||||
{/* محو/نمایان میشوند (transition نرم بهجای پرش ناگهانی) */}
|
{/* Use opacity transitions for smooth slide changes. */}
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
<div className="absolute inset-0">
|
<div className="absolute inset-0">
|
||||||
{slides.map((s, i) => (
|
{slides.map((s, i) => (
|
||||||
@@ -88,7 +81,7 @@ export default function HeroSection() {
|
|||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* لایهی نیمهشفاف پشت متن، برای خوانایی روی هر عکسی */}
|
{/* Overlay for text readability. */}
|
||||||
<div
|
<div
|
||||||
className="absolute inset-0"
|
className="absolute inset-0"
|
||||||
style={{
|
style={{
|
||||||
@@ -98,7 +91,7 @@ export default function HeroSection() {
|
|||||||
/>
|
/>
|
||||||
|
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
{/* متن روی اسلاید: کیکر کوچک + عنوان بزرگ دو خطی + توضیح + دکمه CTA */}
|
{/* Active slide headline, description, and call to action. */}
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
<div
|
<div
|
||||||
className="relative z-10 h-full flex flex-col justify-end md:justify-end px-6 md:px-16 pb-28 md:pb-72">
|
className="relative z-10 h-full flex flex-col justify-end md:justify-end px-6 md:px-16 pb-28 md:pb-72">
|
||||||
@@ -124,7 +117,7 @@ export default function HeroSection() {
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
{/* فلشهای ناوبری دستی (قبلی / بعدی) — وسط دو طرف */}
|
{/* Previous and next slide controls. */}
|
||||||
{/* ------------------------------------------------------------------ */}
|
{/* ------------------------------------------------------------------ */}
|
||||||
<button
|
<button
|
||||||
onClick={() => handleManualNav('prev')}
|
onClick={() => handleManualNav('prev')}
|
||||||
@@ -141,7 +134,7 @@ export default function HeroSection() {
|
|||||||
<LeftOutlined/>
|
<LeftOutlined/>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
{/* نقطههای شمارشگر اسلاید پایین صفحه — کلیک روی هرکدام مستقیم به همان اسلاید میرود */}
|
{/* Jump directly to a slide using the indicators. */}
|
||||||
<div className="absolute bottom-8 inset-x-0 z-20 flex justify-center gap-2">
|
<div className="absolute bottom-8 inset-x-0 z-20 flex justify-center gap-2">
|
||||||
{slides.map((s, i) => (
|
{slides.map((s, i) => (
|
||||||
<button
|
<button
|
||||||
@@ -1,25 +1,23 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
import {useEffect, useRef, useState} from 'react';
|
import {useEffect, useRef, useState} from 'react';
|
||||||
|
import Link from 'next/link';
|
||||||
import {gsap} from 'gsap';
|
import {gsap} from 'gsap';
|
||||||
import {ScrollTrigger} from 'gsap/ScrollTrigger';
|
import {ScrollTrigger} from 'gsap/ScrollTrigger';
|
||||||
import {Modal, Button, message} from 'antd';
|
|
||||||
import {ShoppingCartOutlined} from '@ant-design/icons';
|
|
||||||
import {useDispatch} from 'react-redux';
|
|
||||||
import VendingCard from './VendingCard';
|
import VendingCard from './VendingCard';
|
||||||
import {showcaseVideoSrc} from '@/data/content';
|
import {showcaseVideoSrc} from '@/data/content';
|
||||||
|
import {featuredMachines} from '@/data/products';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
import {addToCart} from '@/store/cartSlice';
|
|
||||||
|
|
||||||
gsap.registerPlugin(ScrollTrigger);
|
gsap.registerPlugin(ScrollTrigger);
|
||||||
|
|
||||||
export default function HorizontalShowcase() {
|
export default function HorizontalShowcase() {
|
||||||
const sectionRef = useRef(null);
|
const sectionRef = useRef<HTMLElement>(null);
|
||||||
const trackRef = useRef(null);
|
const trackRef = useRef<HTMLDivElement>(null);
|
||||||
const videoRef = useRef(null);
|
const videoRef = useRef<HTMLVideoElement>(null);
|
||||||
const dispatch = useDispatch();
|
const {t, locale} = useLanguage();
|
||||||
const {t} = useLanguage();
|
const copy = commerceCopy[locale];
|
||||||
const [quickViewMachine, setQuickViewMachine] = useState(null);
|
|
||||||
const [videoAvailable, setVideoAvailable] = useState(true);
|
const [videoAvailable, setVideoAvailable] = useState(true);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
@@ -33,10 +31,10 @@ export default function HorizontalShowcase() {
|
|||||||
Math.max(track.scrollWidth - window.innerWidth, 0)
|
Math.max(track.scrollWidth - window.innerWidth, 0)
|
||||||
);
|
);
|
||||||
|
|
||||||
let animationFrameId = null;
|
let animationFrameId: number | null = null;
|
||||||
let latestProgress = 0;
|
let latestProgress = 0;
|
||||||
|
|
||||||
const syncVideo = (progress) => {
|
const syncVideo = (progress: number) => {
|
||||||
latestProgress = progress;
|
latestProgress = progress;
|
||||||
if (animationFrameId !== null) return;
|
if (animationFrameId !== null) return;
|
||||||
|
|
||||||
@@ -73,23 +71,6 @@ export default function HorizontalShowcase() {
|
|||||||
return () => ctx.revert();
|
return () => ctx.revert();
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
const handleModalAddToCart = () => {
|
|
||||||
if (!quickViewMachine) return;
|
|
||||||
|
|
||||||
dispatch(
|
|
||||||
addToCart({
|
|
||||||
id: quickViewMachine.id,
|
|
||||||
name: quickViewMachine.name,
|
|
||||||
priceNumeric: quickViewMachine.priceNumeric,
|
|
||||||
priceLabel: quickViewMachine.priceLabel,
|
|
||||||
image: quickViewMachine.image,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
|
|
||||||
message.success(t.cart.addToast(quickViewMachine.name));
|
|
||||||
setQuickViewMachine(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<section id="showcase" ref={sectionRef} className="relative w-full overflow-hidden">
|
<section id="showcase" ref={sectionRef} className="relative w-full overflow-hidden">
|
||||||
<div className="absolute inset-0 z-0">
|
<div className="absolute inset-0 z-0">
|
||||||
@@ -113,39 +94,21 @@ export default function HorizontalShowcase() {
|
|||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ref={trackRef} className="horizontal-track relative z-10" dir="ltr">
|
<div className="relative z-20 h-40 pt-20 bg-page-85 backdrop-blur-md">
|
||||||
{t.machines.map((machine) => (
|
<div className="max-w-7xl h-full mx-auto px-8 flex justify-between items-center gap-4">
|
||||||
<VendingCard key={machine.id} machine={machine} onQuickView={setQuickViewMachine}/>
|
<h2 className="text-2xl font-bold text-primary">{copy.featuredProducts}</h2>
|
||||||
|
<Link href="/products" className="text-brand-400 hover:underline">{copy.allProducts}</Link>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ref={trackRef}
|
||||||
|
className="horizontal-track relative z-10 [&_.horizontal-panel]:h-full [&_.spotlight-stage]:max-h-[calc(100vh-12rem)]"
|
||||||
|
style={{height: 'calc(100vh - 10rem)'}} dir="ltr">
|
||||||
|
{featuredMachines(t.machines).map((machine) => (
|
||||||
|
<VendingCard key={machine.id} machine={machine}/>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<Modal
|
|
||||||
open={!!quickViewMachine}
|
|
||||||
onCancel={() => setQuickViewMachine(null)}
|
|
||||||
footer={null}
|
|
||||||
centered
|
|
||||||
title={quickViewMachine?.name}
|
|
||||||
>
|
|
||||||
{quickViewMachine && (
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
<img
|
|
||||||
src={quickViewMachine.image}
|
|
||||||
alt={quickViewMachine.name}
|
|
||||||
className="w-full h-64 object-contain"
|
|
||||||
/>
|
|
||||||
<p className="text-secondary leading-7">{quickViewMachine.description}</p>
|
|
||||||
<p className="text-xl font-bold text-primary">{quickViewMachine.priceLabel}</p>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="large"
|
|
||||||
icon={<ShoppingCartOutlined/>}
|
|
||||||
onClick={handleModalAddToCart}
|
|
||||||
>
|
|
||||||
{t.machineActions.addToCart}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Modal>
|
|
||||||
</section>
|
</section>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// سکشن مستقل ویدیوی معرفی شرکت (جدا از ویدیوی پسزمینه ویترین محصولات).
|
|
||||||
|
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
|
||||||
import { introVideoSrc, introVideoPoster } from '@/data/content';
|
|
||||||
|
|
||||||
export default function IntroVideoSection() {
|
|
||||||
const { t } = useLanguage();
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section id="video" className="relative px-6 md:px-16 py-20 md:py-28 bg-elevated border-t border-subtle">
|
|
||||||
<div className="max-w-5xl mx-auto text-center">
|
|
||||||
<span className="text-brand-400 text-sm font-semibold tracking-wide">{t.introVideo.eyebrow}</span>
|
|
||||||
<h2 className="text-2xl md:text-4xl font-extrabold brand-gradient-text mt-3 mb-3">
|
|
||||||
{t.introVideo.title}
|
|
||||||
</h2>
|
|
||||||
<p className="text-secondary text-sm md:text-base mb-10">{t.introVideo.subtitle}</p>
|
|
||||||
|
|
||||||
{/*
|
|
||||||
TODO: replace /public/video/company-intro-placeholder.mp4 with the real
|
|
||||||
company introduction video (keep the same filename, or update
|
|
||||||
`introVideoSrc` in data/content.js). The poster image shows before
|
|
||||||
playback starts — swap /public/images/video-poster.svg the same way.
|
|
||||||
*/}
|
|
||||||
<div className="rounded-2xl overflow-hidden border border-subtle shadow-brandGlow">
|
|
||||||
<video controls poster={introVideoPoster} className="w-full aspect-video bg-black">
|
|
||||||
<source src={introVideoSrc} type="video/mp4" />
|
|
||||||
{t.introVideo.videoNotSupported}
|
|
||||||
</video>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// دکمه سوییچ زبان فارسی/انگلیسی.
|
// Switch between Persian and English.
|
||||||
|
|
||||||
import { Button, Tooltip } from 'antd';
|
import { Button, Tooltip } from 'antd';
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
import { useLanguage } from '@/app/context/LanguageContext';
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
// گرید «مکان مناسب برای نصب» — هتلها، مدارس، داروخانهها، بیمارستانها، شیفت شب، محصولات تخصصی.
|
// Suggested installation locations for vending machines.
|
||||||
|
|
||||||
import {
|
import {
|
||||||
HomeOutlined,
|
HomeOutlined,
|
||||||
@@ -1,129 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// نقشه نشان (Neshan) — از Static Map API استفاده میکند. تا وقتی کلید API خالی باشد،
|
|
||||||
// بهجای نقشه یک پیام راهنما نشان داده میشود (نه تصویر خراب).
|
|
||||||
|
|
||||||
import {useState} from 'react';
|
|
||||||
import {EnvironmentOutlined} from '@ant-design/icons';
|
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
|
||||||
import {useTheme} from '@/app/context/ThemeContext';
|
|
||||||
import {mapLocations} from '@/data/content';
|
|
||||||
import Image from "next/image";
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
// Neshan (نشان) map integration.
|
|
||||||
//
|
|
||||||
// TODO: put your Neshan API key here, or (preferred) set it as an environment
|
|
||||||
// variable in `.env.local`:
|
|
||||||
// NEXT_PUBLIC_NESHAN_API_KEY=your-key-here
|
|
||||||
// Get a key from https://platform.neshan.org
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
const NESHAN_API_KEY = process.env.NEXT_PUBLIC_NESHAN_API_KEY || '';
|
|
||||||
|
|
||||||
// Neshan's Static Map API — a plain image, no JS SDK/script tag needed.
|
|
||||||
// Verify query param names/values against the current Neshan docs
|
|
||||||
// (https://platform.neshan.org/api/static-map/) if this ever needs updating —
|
|
||||||
// `type` accepts their day/night map styles, e.g. "standard-day" / "standard-night".
|
|
||||||
function staticMapUrl({lat, lng}, mapStyle) {
|
|
||||||
const params = new URLSearchParams({
|
|
||||||
key: NESHAN_API_KEY,
|
|
||||||
type: mapStyle,
|
|
||||||
center: `${lat},${lng}`,
|
|
||||||
zoom: '15',
|
|
||||||
size: '600x400',
|
|
||||||
marker: `${lat},${lng}`,
|
|
||||||
});
|
|
||||||
return `https://api.neshan.org/v5/static?${params.toString()}`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function neshanViewUrl({lat, lng}) {
|
|
||||||
return `https://neshan.org/maps/@${lat},${lng},15z`;
|
|
||||||
}
|
|
||||||
|
|
||||||
function MapThumb({coords, mapStyle, alt}) {
|
|
||||||
const [errored, setErrored] = useState(false);
|
|
||||||
const {t} = useLanguage();
|
|
||||||
|
|
||||||
if (!NESHAN_API_KEY || errored) {
|
|
||||||
return (
|
|
||||||
<div
|
|
||||||
className="w-full h-full min-h-[280px] flex flex-col items-center justify-center gap-3 bg-surface text-secondary text-sm text-center p-6">
|
|
||||||
<EnvironmentOutlined className="text-3xl text-brand-400"/>
|
|
||||||
<p>{t.map.configNotice}</p>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
// eslint-disable-next-line @next/next/no-img-element
|
|
||||||
<img
|
|
||||||
src={staticMapUrl(coords, mapStyle)}
|
|
||||||
alt={alt}
|
|
||||||
onError={() => setErrored(true)}
|
|
||||||
className="w-full h-full object-cover"
|
|
||||||
/>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default function MapSection() {
|
|
||||||
const {t} = useLanguage();
|
|
||||||
const {theme} = useTheme();
|
|
||||||
const mapStyle = theme === 'dark' ? 'standard-night' : 'standard-day';
|
|
||||||
|
|
||||||
const pins = [
|
|
||||||
{
|
|
||||||
key: 'factory',
|
|
||||||
label: t.map.factoryLabel,
|
|
||||||
coords: mapLocations.factory,
|
|
||||||
address: t.contactInfo.factoryAddress
|
|
||||||
},
|
|
||||||
{
|
|
||||||
key: 'sales',
|
|
||||||
label: t.map.salesLabel,
|
|
||||||
coords: mapLocations.salesOffice,
|
|
||||||
address: t.contactInfo.salesOfficeAddress
|
|
||||||
},
|
|
||||||
];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section id="map" className="relative px-6 md:px-16 py-20 md:py-28 bg-page border-t border-subtle">
|
|
||||||
<div className="max-w-6xl mx-auto">
|
|
||||||
<div className="text-center mb-12">
|
|
||||||
<span className="text-brand-400 text-sm font-semibold tracking-wide">{t.map.eyebrow}</span>
|
|
||||||
<h2 className="text-2xl md:text-4xl font-extrabold brand-gradient-text mt-3">{t.map.title}</h2>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid lg:grid-cols-[1.3fr,1fr] gap-6">
|
|
||||||
<div className="rounded-2xl overflow-hidden border border-subtle h-[360px] lg:h-auto min-h-[360px]">
|
|
||||||
<MapThumb coords={pins[0].coords} mapStyle={mapStyle} alt={pins[0].label}/>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
{pins.map((pin) => (
|
|
||||||
<div key={pin.key} className="bg-surface border border-subtle rounded-2xl p-5">
|
|
||||||
<div className="flex items-start gap-3">
|
|
||||||
<div
|
|
||||||
className="w-10 h-10 shrink-0 rounded-lg bg-brand/15 border border-subtle flex items-center justify-center text-brand-400">
|
|
||||||
<EnvironmentOutlined/>
|
|
||||||
</div>
|
|
||||||
<div>
|
|
||||||
<h3 className="text-primary font-bold text-sm mb-1">{pin.label}</h3>
|
|
||||||
<p className="text-secondary text-sm leading-7 mb-2">{pin.address}</p>
|
|
||||||
<a
|
|
||||||
href={neshanViewUrl(pin.coords)}
|
|
||||||
target="_blank"
|
|
||||||
rel="noopener noreferrer"
|
|
||||||
className="text-brand-400 hover:text-brand-300 text-xs font-semibold transition-colors"
|
|
||||||
>
|
|
||||||
{t.map.openInMaps} ↗
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,107 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import {useState} from 'react';
|
|
||||||
import {Modal, Button, message} from 'antd';
|
|
||||||
import {ShoppingCartOutlined, EyeOutlined} from '@ant-design/icons';
|
|
||||||
import {useDispatch} from 'react-redux';
|
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
|
||||||
import {addToCart} from '@/store/cartSlice';
|
|
||||||
|
|
||||||
export default function MobileShowcase() {
|
|
||||||
const dispatch = useDispatch();
|
|
||||||
const {t, dir} = useLanguage();
|
|
||||||
const [quickViewMachine, setQuickViewMachine] = useState(null);
|
|
||||||
|
|
||||||
const handleAddToCart = (machine) => {
|
|
||||||
dispatch(
|
|
||||||
addToCart({
|
|
||||||
id: machine.id,
|
|
||||||
name: machine.name,
|
|
||||||
priceNumeric: machine.priceNumeric,
|
|
||||||
priceLabel: machine.priceLabel,
|
|
||||||
image: machine.image,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
message.success(t.cart.addToast(machine.name));
|
|
||||||
};
|
|
||||||
|
|
||||||
const handleModalAddToCart = () => {
|
|
||||||
if (!quickViewMachine) return;
|
|
||||||
handleAddToCart(quickViewMachine);
|
|
||||||
setQuickViewMachine(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section id="showcase" className="relative w-full py-8 px-4" dir={dir}>
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
{t.machines.map((machine) => (
|
|
||||||
<div
|
|
||||||
key={machine.id}
|
|
||||||
className="flex gap-4 items-center bg-surface border border-subtle rounded-2xl p-4"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={machine.image}
|
|
||||||
alt={machine.name}
|
|
||||||
className="w-24 h-24 object-contain shrink-0"
|
|
||||||
onClick={() => setQuickViewMachine(machine)}
|
|
||||||
/>
|
|
||||||
|
|
||||||
<div className="flex flex-col gap-1.5 min-w-0 flex-1">
|
|
||||||
<span className="text-brand-400 text-xs font-semibold tracking-wide">
|
|
||||||
{machine.shortLabel}
|
|
||||||
</span>
|
|
||||||
<h3 className="text-lg font-bold text-primary truncate">
|
|
||||||
{machine.name}
|
|
||||||
</h3>
|
|
||||||
<p className="text-sm text-secondary line-clamp-2">
|
|
||||||
{machine.description}
|
|
||||||
</p>
|
|
||||||
<p className="text-base font-bold text-primary mt-1">
|
|
||||||
{machine.priceLabel}
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<div className="flex justify-start items-center mt-3">
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="middle"
|
|
||||||
icon={<ShoppingCartOutlined/>}
|
|
||||||
onClick={() => handleAddToCart(machine)}
|
|
||||||
>
|
|
||||||
{t.machineActions.addToCart}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Modal
|
|
||||||
open={!!quickViewMachine}
|
|
||||||
onCancel={() => setQuickViewMachine(null)}
|
|
||||||
footer={null}
|
|
||||||
centered
|
|
||||||
title={quickViewMachine?.name}
|
|
||||||
>
|
|
||||||
{quickViewMachine && (
|
|
||||||
<div className="flex flex-col gap-4">
|
|
||||||
<img
|
|
||||||
src={quickViewMachine.image}
|
|
||||||
alt={quickViewMachine.name}
|
|
||||||
className="w-full h-64 object-contain"
|
|
||||||
/>
|
|
||||||
<p className="text-secondary leading-7">{quickViewMachine.description}</p>
|
|
||||||
<p className="text-xl font-bold text-primary">{quickViewMachine.priceLabel}</p>
|
|
||||||
<Button
|
|
||||||
type="primary"
|
|
||||||
size="large"
|
|
||||||
icon={<ShoppingCartOutlined/>}
|
|
||||||
onClick={handleModalAddToCart}
|
|
||||||
>
|
|
||||||
{t.machineActions.addToCart}
|
|
||||||
</Button>
|
|
||||||
</div>
|
|
||||||
)}
|
|
||||||
</Modal>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {featuredMachines} from '@/data/products';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import QuantityControl from './QuantityControl';
|
||||||
|
|
||||||
|
export default function MobileShowcase() {
|
||||||
|
const {t, dir, locale} = useLanguage();
|
||||||
|
|
||||||
|
return (
|
||||||
|
<section id="showcase" className="relative w-full py-8 px-4" dir={dir}>
|
||||||
|
<div className="flex gap-4 overflow-x-auto snap-x snap-mandatory pb-4">
|
||||||
|
{featuredMachines(t.machines).map(machine => (
|
||||||
|
<article key={machine.id} className="w-[90%] shrink-0 snap-start bg-surface border border-subtle rounded-2xl p-4">
|
||||||
|
<Link href={`/products/${machine.id}`} className="flex gap-4 items-center">
|
||||||
|
<img src={machine.image} alt={machine.name} className="w-24 h-28 object-contain shrink-0"/>
|
||||||
|
<div className="min-w-0">
|
||||||
|
<span className="text-brand-400 text-xs font-semibold">{machine.shortLabel}</span>
|
||||||
|
<h3 className="text-lg font-bold text-primary mt-1">{machine.name}</h3>
|
||||||
|
<p className="text-sm text-secondary line-clamp-2 mt-2">{machine.description}</p>
|
||||||
|
</div>
|
||||||
|
</Link>
|
||||||
|
<p className="text-base font-bold text-primary my-4">{machine.priceLabel}</p>
|
||||||
|
<div className="flex flex-wrap justify-between items-center gap-3">
|
||||||
|
<QuantityControl product={machine}/>
|
||||||
|
<Link href={`/products/${machine.id}`} className="text-sm text-brand-400 hover:underline">
|
||||||
|
{commerceCopy[locale].details}
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import {useState} from 'react';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {CheckCircleOutlined} from '@ant-design/icons';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import QuantityControl from './QuantityControl';
|
||||||
|
|
||||||
|
export default function ProductDetails({id}: {id: string}) {
|
||||||
|
const {t, locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
const machine = t.machines.find(item => item.id === id);
|
||||||
|
const [alternate, setAlternate] = useState(false);
|
||||||
|
if (!machine) return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-7xl mx-auto px-5 md:px-8 pt-28 pb-20">
|
||||||
|
<nav aria-label={copy.details} className="text-sm text-secondary flex flex-wrap gap-3 mb-8">
|
||||||
|
<Link href="/" className="hover:text-brand-400">{t.nav.home}</Link>
|
||||||
|
<span aria-hidden="true">/</span>
|
||||||
|
<Link href="/products" className="hover:text-brand-400">{t.nav.showcase}</Link>
|
||||||
|
<span aria-hidden="true">/</span><span>{machine.shortLabel}</span>
|
||||||
|
</nav>
|
||||||
|
<div className="grid md:grid-cols-2 gap-10 lg:gap-16 items-start">
|
||||||
|
<section aria-label={copy.gallery} className="rounded-3xl border border-subtle bg-surface p-6">
|
||||||
|
<img src={alternate ? machine.imageAlt : machine.image} alt={`${machine.name} — ${alternate ? copy.alternateImage : copy.baseImage}`}
|
||||||
|
className="w-full h-72 md:h-[450px] object-contain"/>
|
||||||
|
<div className="flex justify-center gap-3 mt-6">
|
||||||
|
{[false, true].map(value => (
|
||||||
|
<button key={String(value)} onClick={() => setAlternate(value)} aria-pressed={alternate === value}
|
||||||
|
aria-label={value ? copy.alternateImage : copy.baseImage}
|
||||||
|
className={`rounded-xl border p-2 ${alternate === value ? 'border-brand bg-brand/10' : 'border-subtle'}`}>
|
||||||
|
<img src={value ? machine.imageAlt : machine.image} alt="" className="h-20 w-20 object-contain"/>
|
||||||
|
</button>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section>
|
||||||
|
<p className="text-brand-400 font-semibold">{machine.shortLabel}</p>
|
||||||
|
<h1 className="text-3xl lg:text-4xl font-extrabold text-primary mt-3 leading-relaxed">{machine.name}</h1>
|
||||||
|
<p className="text-secondary mt-5 leading-8">{machine.description}</p>
|
||||||
|
<p className="text-sm text-secondary mt-4">{copy.model}: <span dir="ltr">{machine.id.toUpperCase()}</span></p>
|
||||||
|
<h2 className="font-bold text-primary text-xl mt-8 mb-4">{copy.specifications}</h2>
|
||||||
|
<ul className="space-y-3">
|
||||||
|
{machine.highlights.map(feature => <li key={feature} className="flex gap-3 text-secondary"><CheckCircleOutlined className="text-brand-400"/>{feature}</li>)}
|
||||||
|
</ul>
|
||||||
|
<div className="border-t border-subtle mt-8 pt-6">
|
||||||
|
<p className="text-sm text-secondary">{copy.unitPrice}</p>
|
||||||
|
<p className="text-2xl font-bold text-primary mt-2">{machine.priceLabel}</p>
|
||||||
|
<div className="mt-5 flex flex-wrap gap-4 items-center">
|
||||||
|
<QuantityControl product={machine}/>
|
||||||
|
<Link href="/cart" className="text-brand-400 font-semibold hover:underline">{copy.cartLink}</Link>
|
||||||
|
</div>
|
||||||
|
<p className="text-secondary text-sm leading-7 mt-5">{copy.checkoutUnavailable}</p>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,69 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {usePathname, useRouter, useSearchParams} from 'next/navigation';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import {filterMachines, productCategories} from '@/data/products';
|
||||||
|
import QuantityControl from './QuantityControl';
|
||||||
|
|
||||||
|
export default function ProductsPage() {
|
||||||
|
const {t, locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
const searchParams = useSearchParams();
|
||||||
|
const pathname = usePathname();
|
||||||
|
const router = useRouter();
|
||||||
|
const category = searchParams.get('category') ?? '';
|
||||||
|
const products = filterMachines(t.machines, category);
|
||||||
|
const knownCategory = productCategories.some(item => item.id === category);
|
||||||
|
|
||||||
|
const setCategory = (value: string) => {
|
||||||
|
const params = new URLSearchParams(searchParams.toString());
|
||||||
|
if (value) params.set('category', value);
|
||||||
|
else params.delete('category');
|
||||||
|
// Preserve other query parameters and allow browser Back to restore filters.
|
||||||
|
const query = params.toString();
|
||||||
|
router.push(query ? `${pathname}?${query}` : pathname, {scroll: false});
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<main className="max-w-7xl mx-auto px-5 md:px-8 pt-28 pb-20 min-h-[70vh]">
|
||||||
|
<h1 className="text-3xl md:text-4xl font-extrabold text-primary">{copy.allProducts}</h1>
|
||||||
|
<p className="text-secondary mt-4 leading-7">{copy.productsDescription}</p>
|
||||||
|
<div className="mt-8 mb-8 rounded-2xl border border-subtle bg-surface p-5 flex flex-wrap items-end gap-4">
|
||||||
|
<div className="flex flex-col gap-2 w-full sm:w-72">
|
||||||
|
<label htmlFor="product-category" className="text-sm font-semibold text-primary">{copy.category}</label>
|
||||||
|
<select id="product-category" value={category} onChange={event => setCategory(event.target.value)}
|
||||||
|
className="w-full border border-subtle bg-elevated text-primary rounded-xl px-4 py-3 focus:outline-brand">
|
||||||
|
<option value="">{copy.allCategories}</option>
|
||||||
|
{category && !knownCategory && <option value={category}>{copy.unknownCategory}</option>}
|
||||||
|
{productCategories.map(item => <option key={item.id} value={item.id}>{item.label[locale]}</option>)}
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
{category && <button onClick={() => setCategory('')} className="text-brand-400 py-3 hover:underline">{copy.clearFilters}</button>}
|
||||||
|
<p aria-live="polite" aria-atomic="true" className="text-secondary text-sm py-3 sm:ms-auto">
|
||||||
|
{products.length.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US')} {copy.results}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{products.length ? (
|
||||||
|
<div className="grid sm:grid-cols-2 lg:grid-cols-3 gap-6">
|
||||||
|
{products.map(machine => (
|
||||||
|
<article key={machine.id} className="flex flex-col rounded-3xl border border-subtle bg-surface p-5">
|
||||||
|
<Link href={`/products/${machine.id}`} className="rounded-2xl bg-page p-5">
|
||||||
|
<img src={machine.image} alt={machine.name} className="w-full h-60 object-contain"/>
|
||||||
|
</Link>
|
||||||
|
<span className="text-brand-400 text-xs mt-5">{productCategories.find(item => item.id === machine.category)?.label[locale]}</span>
|
||||||
|
<h2 className="text-xl font-bold text-primary mt-2"><Link href={`/products/${machine.id}`}>{machine.name}</Link></h2>
|
||||||
|
<p className="text-secondary text-sm leading-7 mt-3 mb-5">{machine.description}</p>
|
||||||
|
<p className="text-primary text-lg font-bold mt-auto mb-4">{machine.priceLabel}</p>
|
||||||
|
<div className="flex flex-wrap items-center justify-between gap-3">
|
||||||
|
<QuantityControl product={machine}/>
|
||||||
|
<Link href={`/products/${machine.id}`} className="text-brand-400 text-sm hover:underline">{copy.details}</Link>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
))}
|
||||||
|
</div>
|
||||||
|
) : <div className="text-center text-secondary border border-subtle rounded-2xl p-12">{copy.noProducts}</div>}
|
||||||
|
</main>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import {Button} from 'antd';
|
||||||
|
import {MinusOutlined, PlusOutlined} from '@ant-design/icons';
|
||||||
|
import type {CartProduct} from '@/types/domain';
|
||||||
|
import {useAppDispatch, useAppSelector} from '@/store/hooks';
|
||||||
|
import {addToCart, decrementQty} from '@/store/cartSlice';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
|
||||||
|
export default function QuantityControl({product}: {product: CartProduct}) {
|
||||||
|
const dispatch = useAppDispatch();
|
||||||
|
const {locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
const quantity = useAppSelector(state => state.cart.items.find(item => item.id === product.id)?.qty ?? 0);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div role="group" aria-label={`${copy.quantity}: ${product.name}`}
|
||||||
|
className="inline-flex items-center gap-3 rounded-xl border border-subtle bg-page p-1" dir="ltr">
|
||||||
|
<Button icon={<MinusOutlined/>} disabled={quantity === 0}
|
||||||
|
aria-label={`${copy.decrease}: ${product.name}`}
|
||||||
|
onClick={() => dispatch(decrementQty(product.id))}/>
|
||||||
|
<span aria-live="polite" aria-atomic="true" className="min-w-8 text-center font-bold text-primary">
|
||||||
|
{quantity.toLocaleString(locale === 'fa' ? 'fa-IR' : 'en-US')}
|
||||||
|
</span>
|
||||||
|
<Button type="primary" icon={<PlusOutlined/>}
|
||||||
|
aria-label={`${copy.increase}: ${product.name}`}
|
||||||
|
onClick={() => dispatch(addToCart({id: product.id, name: product.name, image: product.image,
|
||||||
|
priceLabel: product.priceLabel, priceNumeric: product.priceNumeric}))}/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
import {useEffect, useState} from 'react';
|
|
||||||
import HorizontalShowcase from './HorizontalShowcase';
|
|
||||||
import MobileShowcase from './MobileShowcase';
|
|
||||||
|
|
||||||
const MOBILE_BREAKPOINT = 768;
|
|
||||||
|
|
||||||
export default function ShowcaseSection() {
|
|
||||||
const [isMobile, setIsMobile] = useState(null);
|
|
||||||
|
|
||||||
useEffect(() => {
|
|
||||||
const mediaQuery = window.matchMedia(
|
|
||||||
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
|
||||||
);
|
|
||||||
|
|
||||||
const handleChange = (event) => setIsMobile(event.matches);
|
|
||||||
|
|
||||||
setIsMobile(mediaQuery.matches);
|
|
||||||
mediaQuery.addEventListener('change', handleChange);
|
|
||||||
|
|
||||||
return () => mediaQuery.removeEventListener('change', handleChange);
|
|
||||||
}, []);
|
|
||||||
|
|
||||||
if (isMobile === null) return null;
|
|
||||||
|
|
||||||
return isMobile ? <MobileShowcase/> : <HorizontalShowcase/>;
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import {useEffect, useState} from 'react';
|
||||||
|
import Link from 'next/link';
|
||||||
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
|
import {commerceCopy} from '@/data/commerce';
|
||||||
|
import HorizontalShowcase from './HorizontalShowcase';
|
||||||
|
import MobileShowcase from './MobileShowcase';
|
||||||
|
|
||||||
|
const MOBILE_BREAKPOINT = 768;
|
||||||
|
|
||||||
|
export default function ShowcaseSection() {
|
||||||
|
const {locale} = useLanguage();
|
||||||
|
const copy = commerceCopy[locale];
|
||||||
|
const [isMobile, setIsMobile] = useState<boolean | null>(null);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const mediaQuery = window.matchMedia(
|
||||||
|
`(max-width: ${MOBILE_BREAKPOINT - 1}px)`
|
||||||
|
);
|
||||||
|
|
||||||
|
const handleChange = (event: MediaQueryListEvent) => setIsMobile(event.matches);
|
||||||
|
|
||||||
|
setIsMobile(mediaQuery.matches);
|
||||||
|
mediaQuery.addEventListener('change', handleChange);
|
||||||
|
|
||||||
|
return () => mediaQuery.removeEventListener('change', handleChange);
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
if (isMobile === null) return null;
|
||||||
|
if (!isMobile) return <HorizontalShowcase/>;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<>
|
||||||
|
<div className="max-w-7xl mx-auto px-5 md:px-8 py-8 flex flex-wrap justify-between items-center gap-4">
|
||||||
|
<h2 className="text-2xl font-bold text-primary">{copy.featuredProducts}</h2>
|
||||||
|
<Link href="/products" className="text-brand-400 hover:underline">{copy.allProducts}</Link>
|
||||||
|
</div>
|
||||||
|
<MobileShowcase/>
|
||||||
|
</>
|
||||||
|
);
|
||||||
|
}
|
||||||
@@ -1,119 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
// فرم ثبت تیکت پشتیبانی با اعتبارسنجی antd؛ ارسال واقعی به بکاند در بلوک TODO داخل کد مشخص شده.
|
|
||||||
|
|
||||||
import { Form, Input, Select, Button, message } from 'antd';
|
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
|
||||||
|
|
||||||
const { TextArea } = Input;
|
|
||||||
|
|
||||||
export default function TicketForm() {
|
|
||||||
const { t, locale } = useLanguage();
|
|
||||||
const [form] = Form.useForm();
|
|
||||||
|
|
||||||
const handleFinish = async (values) => {
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
// TODO: Connect to the real ticketing/support API.
|
|
||||||
//
|
|
||||||
// import axios from 'axios';
|
|
||||||
//
|
|
||||||
// try {
|
|
||||||
// await axios.post('/api/tickets', values);
|
|
||||||
// } catch (err) {
|
|
||||||
// message.error('...');
|
|
||||||
// return;
|
|
||||||
// }
|
|
||||||
|
|
||||||
// api() <===> todo : use this func to fetch ...
|
|
||||||
|
|
||||||
// -------------------------------------------------------------------
|
|
||||||
console.log('Ticket submitted (placeholder):', values);
|
|
||||||
message.success(t.ticket.successMsg);
|
|
||||||
form.resetFields();
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section id="support" className="relative px-6 md:px-16 py-20 md:py-28 bg-surface border-t border-subtle">
|
|
||||||
<div className="max-w-2xl mx-auto">
|
|
||||||
<div className="text-center mb-10">
|
|
||||||
<span className="text-brand-400 text-sm font-semibold tracking-wide">{t.ticket.eyebrow}</span>
|
|
||||||
<h2 className="text-2xl md:text-4xl font-extrabold brand-gradient-text mt-3 mb-3">
|
|
||||||
{t.ticket.title}
|
|
||||||
</h2>
|
|
||||||
<p className="text-secondary text-sm md:text-base">{t.ticket.subtitle}</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Form
|
|
||||||
form={form}
|
|
||||||
layout="vertical"
|
|
||||||
onFinish={handleFinish}
|
|
||||||
requiredMark={false}
|
|
||||||
initialValues={{ priority: 'medium' }}
|
|
||||||
>
|
|
||||||
<div className="grid md:grid-cols-2 gap-x-4">
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.name}</span>}
|
|
||||||
name="name"
|
|
||||||
rules={[{ required: true, message: t.ticket.requiredMsg }]}
|
|
||||||
>
|
|
||||||
<Input size="large" placeholder={t.ticket.namePlaceholder} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.phone}</span>}
|
|
||||||
name="phone"
|
|
||||||
rules={[
|
|
||||||
{ required: true, message: t.ticket.requiredMsg },
|
|
||||||
{ pattern: /^[0-9+\s-]{7,15}$/, message: t.ticket.invalidPhone },
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Input size="large" placeholder={t.ticket.phonePlaceholder} dir="ltr" />
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div className="grid md:grid-cols-2 gap-x-4">
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.email}</span>}
|
|
||||||
name="email"
|
|
||||||
rules={[{ type: 'email', message: t.ticket.invalidEmail }]}
|
|
||||||
>
|
|
||||||
<Input size="large" placeholder={t.ticket.emailPlaceholder} dir="ltr" />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.priority}</span>}
|
|
||||||
name="priority"
|
|
||||||
>
|
|
||||||
<Select
|
|
||||||
size="large"
|
|
||||||
options={t.ticket.priorities.map((p) => ({ value: p.value, label: p.label }))}
|
|
||||||
/>
|
|
||||||
</Form.Item>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.subject}</span>}
|
|
||||||
name="subject"
|
|
||||||
rules={[{ required: true, message: t.ticket.requiredMsg }]}
|
|
||||||
>
|
|
||||||
<Input size="large" placeholder={t.ticket.subjectPlaceholder} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item
|
|
||||||
label={<span className="text-secondary">{t.ticket.message}</span>}
|
|
||||||
name="message"
|
|
||||||
rules={[{ required: true, message: t.ticket.requiredMsg }]}
|
|
||||||
>
|
|
||||||
<TextArea rows={5} placeholder={t.ticket.messagePlaceholder} />
|
|
||||||
</Form.Item>
|
|
||||||
|
|
||||||
<Form.Item className="mb-0">
|
|
||||||
<Button type="primary" size="large" htmlType="submit" block>
|
|
||||||
{t.ticket.submit}
|
|
||||||
</Button>
|
|
||||||
</Form.Item>
|
|
||||||
</Form>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
'use client';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* سکشن «مشتریانی که به ما اعتماد کردهاند» — یک نوار لوگوی بیپایان (marquee)
|
|
||||||
* که بهآرامی و پیوسته حرکت میکند. برای ساخت افکت حلقهی بیپایان، لیست
|
|
||||||
* لوگوها را دو بار پشتسرهم رندر میکنیم و با انیمیشن CSS آن را جابهجا میکنیم.
|
|
||||||
*
|
|
||||||
* نکته فنی: مسیر (track) همیشه جهت LTR دارد، چون منطق «حرکت به چپ» انیمیشن
|
|
||||||
* فرض بر همین جهت است — دقیقاً همان مشکلی که در اسکرول افقی محصولات داشتیم و
|
|
||||||
* حلش کردیم. اینجا هم برای جلوگیری از همان باگ، جهت را ثابت نگه داشتیم.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import { useLanguage } from '@/app/context/LanguageContext';
|
|
||||||
|
|
||||||
export default function TrustedBySection() {
|
|
||||||
const { t } = useLanguage();
|
|
||||||
const clients = t.trustedBy.clients;
|
|
||||||
// لیست لوگوها را دو برابر میکنیم تا وقتی نیمه اول با انیمیشن رد شد،
|
|
||||||
// نیمه دوم دقیقاً از همانجا ادامه بدهد و چشم متوجه پرش/شکاف نشود.
|
|
||||||
const doubledClients = [...clients, ...clients];
|
|
||||||
|
|
||||||
return (
|
|
||||||
<section className="relative px-6 md:px-16 py-16 md:py-20 bg-page border-t border-subtle overflow-hidden">
|
|
||||||
<div className="max-w-6xl mx-auto">
|
|
||||||
<div className="text-center mb-10">
|
|
||||||
<span className="text-brand-400 text-sm font-semibold tracking-wide">{t.trustedBy.eyebrow}</span>
|
|
||||||
<h2 className="text-xl md:text-2xl font-extrabold text-primary mt-2">{t.trustedBy.title}</h2>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
{/* یک محو تدریجی (fade mask) دو طرف نوار، تا لبههای لوگوها بریده بهنظر نرسد */}
|
|
||||||
<div
|
|
||||||
className="relative"
|
|
||||||
style={{
|
|
||||||
maskImage: 'linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%)',
|
|
||||||
WebkitMaskImage: 'linear-gradient(90deg, transparent 0%, black 8%, black 92%, transparent 100%)',
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<div className="flex w-max animate-marquee gap-10" dir="ltr">
|
|
||||||
{doubledClients.map((client, i) => (
|
|
||||||
<div
|
|
||||||
key={`${client.id}-${i}`}
|
|
||||||
className="w-40 md:w-48 shrink-0 flex items-center justify-center bg-surface border border-subtle rounded-xl p-4 opacity-80 hover:opacity-100 transition-opacity"
|
|
||||||
>
|
|
||||||
<img
|
|
||||||
src={`/images/clients/client-${((i % clients.length) + 1)}.svg`}
|
|
||||||
alt={client.name}
|
|
||||||
className="w-full h-auto"
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</section>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@@ -1,23 +1,23 @@
|
|||||||
'use client';
|
'use client';
|
||||||
|
|
||||||
|
|
||||||
|
import type {Machine} from '@/types/domain';
|
||||||
|
import type {MouseEvent} from 'react';
|
||||||
import {useRef} from 'react';
|
import {useRef} from 'react';
|
||||||
import {Button, message} from 'antd';
|
import Link from 'next/link';
|
||||||
import {ShoppingCartOutlined, EyeOutlined} from '@ant-design/icons';
|
import QuantityControl from './QuantityControl';
|
||||||
import {useDispatch} from 'react-redux';
|
import {commerceCopy} from '@/data/commerce';
|
||||||
import {addToCart} from '@/store/cartSlice';
|
|
||||||
import {useLanguage} from '@/app/context/LanguageContext';
|
import {useLanguage} from '@/app/context/LanguageContext';
|
||||||
import FloatingItems from './FloatingItems';
|
import FloatingItems from './FloatingItems';
|
||||||
import {floatingSnacks} from '@/data/content';
|
import {floatingSnacks} from '@/data/content';
|
||||||
|
|
||||||
export default function VendingCard({machine, onQuickView}) {
|
export default function VendingCard({machine}: {machine: Machine}) {
|
||||||
const dispatch = useDispatch();
|
const {t, dir, locale} = useLanguage();
|
||||||
const {t, dir} = useLanguage();
|
const stageRef = useRef<HTMLDivElement>(null);
|
||||||
const stageRef = useRef(null);
|
const lensRef = useRef<HTMLDivElement>(null);
|
||||||
const lensRef = useRef(null);
|
const revealRef = useRef<HTMLImageElement>(null);
|
||||||
const revealRef = useRef(null);
|
|
||||||
|
|
||||||
const handleMouseMove = (e) => {
|
const handleMouseMove = (e: MouseEvent<HTMLDivElement>) => {
|
||||||
const stage = stageRef.current;
|
const stage = stageRef.current;
|
||||||
if (!stage) return;
|
if (!stage) return;
|
||||||
const rect = stage.getBoundingClientRect();
|
const rect = stage.getBoundingClientRect();
|
||||||
@@ -36,19 +36,6 @@ export default function VendingCard({machine, onQuickView}) {
|
|||||||
if (revealRef.current) revealRef.current.style.clipPath = 'circle(0px at 50% 50%)';
|
if (revealRef.current) revealRef.current.style.clipPath = 'circle(0px at 50% 50%)';
|
||||||
};
|
};
|
||||||
|
|
||||||
const handleAddToCart = () => {
|
|
||||||
dispatch(
|
|
||||||
addToCart({
|
|
||||||
id: machine.id,
|
|
||||||
name: machine.name,
|
|
||||||
priceNumeric: machine.priceNumeric,
|
|
||||||
priceLabel: machine.priceLabel,
|
|
||||||
image: machine.image,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
message.success(t.cart.addToast(machine.name));
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="horizontal-panel flex items-center justify-center px-6 md:px-16" dir={dir}>
|
<div className="horizontal-panel flex items-center justify-center px-6 md:px-16" dir={dir}>
|
||||||
<div className="relative z-10 max-w-6xl w-full grid md:grid-cols-2 gap-0 md:gap-10 items-center">
|
<div className="relative z-10 max-w-6xl w-full grid md:grid-cols-2 gap-0 md:gap-10 items-center">
|
||||||
@@ -101,12 +88,10 @@ export default function VendingCard({machine, onQuickView}) {
|
|||||||
<p className="text-xl md:text-2xl font-bold text-primary mt-2">{machine.priceLabel}</p>
|
<p className="text-xl md:text-2xl font-bold text-primary mt-2">{machine.priceLabel}</p>
|
||||||
|
|
||||||
<div className="flex flex-wrap items-center gap-2 mt-2 ">
|
<div className="flex flex-wrap items-center gap-2 mt-2 ">
|
||||||
{/* <Button type="primary" size="large" icon={<ShoppingCartOutlined/>} onClick={handleAddToCart}>
|
<QuantityControl product={machine}/>
|
||||||
{t.machineActions.addToCart}
|
<Link href={`/products/${machine.id}`} className="px-5 py-3 rounded-xl border border-subtle text-primary hover:text-brand-400">
|
||||||
</Button>*/}
|
{commerceCopy[locale].details}
|
||||||
<Button size="large" icon={<EyeOutlined/>} onClick={() => onQuickView?.(machine)}>
|
</Link>
|
||||||
{t.machineActions.quickView}
|
|
||||||
</Button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
import type {Locale} from '@/types/domain';
|
||||||
|
|
||||||
|
const fa = {
|
||||||
|
allProducts: 'همه محصولات',
|
||||||
|
featuredProducts: 'محصولات منتخب',
|
||||||
|
productsDescription: 'دستگاه مناسب خود را انتخاب کنید و مشخصات آن را بررسی کنید.',
|
||||||
|
category: 'دستهبندی محصولات',
|
||||||
|
allCategories: 'همه دستهبندیها',
|
||||||
|
clearFilters: 'پاک کردن فیلتر',
|
||||||
|
noProducts: 'محصولی با این دستهبندی پیدا نشد.',
|
||||||
|
unknownCategory: 'دستهبندی نامعتبر',
|
||||||
|
results: 'محصول',
|
||||||
|
details: 'جزئیات محصول',
|
||||||
|
increase: 'افزایش تعداد',
|
||||||
|
decrease: 'کاهش تعداد',
|
||||||
|
quantity: 'تعداد',
|
||||||
|
remove: 'حذف از سبد',
|
||||||
|
continueShopping: 'مشاهده دستگاهها',
|
||||||
|
cartDescription: 'دستگاههای انتخابشده و تعداد آنها را اینجا بررسی کنید.',
|
||||||
|
summary: 'خلاصه سبد خرید',
|
||||||
|
unitPrice: 'قیمت هر دستگاه',
|
||||||
|
lineTotal: 'جمع این دستگاه',
|
||||||
|
currency: 'ریال',
|
||||||
|
cartLink: 'مشاهده سبد خرید',
|
||||||
|
specifications: 'ویژگیهای دستگاه',
|
||||||
|
model: 'مدل دستگاه',
|
||||||
|
gallery: 'تصاویر دستگاه',
|
||||||
|
baseImage: 'نمای اصلی',
|
||||||
|
alternateImage: 'نمای جایگزین',
|
||||||
|
developmentTitle: 'روبات مارکت در حال توسعه است',
|
||||||
|
developmentMessage: 'به روبات مارکت خوش آمدید. سایت در حال توسعه است و هنوز تمام بخشهای آن تکمیل نشدهاند.',
|
||||||
|
acknowledge: 'متوجه شدم، ادامه میدهم',
|
||||||
|
checkoutUnavailable: 'ثبت نهایی سفارش و پرداخت آنلاین هنوز فعال نیست.',
|
||||||
|
};
|
||||||
|
|
||||||
|
export const commerceCopy: Record<Locale, Record<keyof typeof fa, string>> = {
|
||||||
|
fa,
|
||||||
|
en: {
|
||||||
|
allProducts: 'All products',
|
||||||
|
featuredProducts: 'Featured products',
|
||||||
|
productsDescription: 'Choose a machine and explore its specifications.',
|
||||||
|
category: 'Product category',
|
||||||
|
allCategories: 'All categories',
|
||||||
|
clearFilters: 'Clear filter',
|
||||||
|
noProducts: 'No products found in this category.',
|
||||||
|
unknownCategory: 'Unknown category',
|
||||||
|
results: 'products',
|
||||||
|
details: 'Product details',
|
||||||
|
increase: 'Increase quantity',
|
||||||
|
decrease: 'Decrease quantity',
|
||||||
|
quantity: 'Quantity',
|
||||||
|
remove: 'Remove from cart',
|
||||||
|
continueShopping: 'Browse machines',
|
||||||
|
cartDescription: 'Review your selected machines and adjust their quantities.',
|
||||||
|
summary: 'Cart summary',
|
||||||
|
unitPrice: 'Unit price',
|
||||||
|
lineTotal: 'Item total',
|
||||||
|
currency: 'Rials',
|
||||||
|
cartLink: 'View cart',
|
||||||
|
specifications: 'Machine features',
|
||||||
|
model: 'Machine model',
|
||||||
|
gallery: 'Machine images',
|
||||||
|
baseImage: 'Main view',
|
||||||
|
alternateImage: 'Alternate view',
|
||||||
|
developmentTitle: 'Robot Market is under development',
|
||||||
|
developmentMessage: 'Welcome to Robot Market. Our website is still under development and some features are not yet complete. You can explore machines and add them to your cart, but order submission and online payment are not available yet.',
|
||||||
|
acknowledge: 'Got it, continue',
|
||||||
|
checkoutUnavailable: 'Order submission and online payment are not available yet.',
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -1,16 +1,19 @@
|
|||||||
|
import type {FloatingSnack, Locale, Machine, SiteContent} from '@/types/domain';
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// Single bilingual content source (fa/en). Every UI string and every piece of
|
// Single bilingual content source (fa/en). Every UI string and every piece of
|
||||||
// business copy lives here, per locale. Components read via useLanguage().
|
// business copy lives here, per locale. Components read via useLanguage().
|
||||||
// Asset paths (images/gifs/video) are locale-independent and stay the same.
|
// Asset paths (images/gifs/video) are locale-independent and stay the same.
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
const machinesFa = [
|
const machinesFa: Machine[] = [
|
||||||
{
|
{
|
||||||
id: 'rm-35',
|
id: 'rm-35',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'روبات مارکت ۳۵ کانال',
|
name: 'روبات مارکت ۳۵ کانال',
|
||||||
shortLabel: '۳۵ کانال',
|
shortLabel: '۳۵ کانال',
|
||||||
priceLabel: '4,200,000,000 ریال',
|
priceLabel: '4,180,000,000 ریال',
|
||||||
priceNumeric: 4200000000,
|
priceNumeric: 4180000000,
|
||||||
description: 'یخچالدار، ۳۵ کانال اختصاصی، سیستم خنککننده قدرتمند، تحویل نرم، مدیریت آنلاین ۲۴ ساعته.',
|
description: 'یخچالدار، ۳۵ کانال اختصاصی، سیستم خنککننده قدرتمند، تحویل نرم، مدیریت آنلاین ۲۴ ساعته.',
|
||||||
highlights: ['یخچالدار', '۳۵ کانال اختصاصی', 'تحویل نرم', 'مدیریت آنلاین ۲۴ ساعته'],
|
highlights: ['یخچالدار', '۳۵ کانال اختصاصی', 'تحویل نرم', 'مدیریت آنلاین ۲۴ ساعته'],
|
||||||
image: '/images/machine-35-base.webp',
|
image: '/images/machine-35-base.webp',
|
||||||
@@ -19,6 +22,7 @@ const machinesFa = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rm-48',
|
id: 'rm-48',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'روبات مارکت ۴۸ کانال',
|
name: 'روبات مارکت ۴۸ کانال',
|
||||||
shortLabel: '۴۸ کانال',
|
shortLabel: '۴۸ کانال',
|
||||||
priceLabel: '4,980,000,000 ریال',
|
priceLabel: '4,980,000,000 ریال',
|
||||||
@@ -31,6 +35,7 @@ const machinesFa = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rm-60',
|
id: 'rm-60',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'روبات مارکت ۶۰ کانال',
|
name: 'روبات مارکت ۶۰ کانال',
|
||||||
shortLabel: '۶۰ کانال',
|
shortLabel: '۶۰ کانال',
|
||||||
priceLabel: '5,480,000,000 ریال',
|
priceLabel: '5,480,000,000 ریال',
|
||||||
@@ -43,9 +48,10 @@ const machinesFa = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
const machinesEn = [
|
const machinesEn: Machine[] = [
|
||||||
{
|
{
|
||||||
id: 'rm-35',
|
id: 'rm-35',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'Robot Market RM-35',
|
name: 'Robot Market RM-35',
|
||||||
shortLabel: '35 Channels',
|
shortLabel: '35 Channels',
|
||||||
priceLabel: '4,180,000,000 Rials',
|
priceLabel: '4,180,000,000 Rials',
|
||||||
@@ -58,6 +64,7 @@ const machinesEn = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rm-48',
|
id: 'rm-48',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'Robot Market RM-48',
|
name: 'Robot Market RM-48',
|
||||||
shortLabel: '48 Channels',
|
shortLabel: '48 Channels',
|
||||||
priceLabel: '4,980,000,000 Rials',
|
priceLabel: '4,980,000,000 Rials',
|
||||||
@@ -70,6 +77,7 @@ const machinesEn = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
id: 'rm-60',
|
id: 'rm-60',
|
||||||
|
category: 'warm-vending',
|
||||||
name: 'Robot Market RM-60',
|
name: 'Robot Market RM-60',
|
||||||
shortLabel: '60 Channels',
|
shortLabel: '60 Channels',
|
||||||
priceLabel: '5,480,000,000 Rials',
|
priceLabel: '5,480,000,000 Rials',
|
||||||
@@ -82,7 +90,7 @@ const machinesEn = [
|
|||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
export const content = {
|
export const content: Record<Locale, SiteContent> = {
|
||||||
fa: {
|
fa: {
|
||||||
dir: 'rtl',
|
dir: 'rtl',
|
||||||
lang: 'fa',
|
lang: 'fa',
|
||||||
@@ -96,10 +104,6 @@ export const content = {
|
|||||||
showcase: 'دستگاهها',
|
showcase: 'دستگاهها',
|
||||||
about: 'درباره ما',
|
about: 'درباره ما',
|
||||||
locations: 'مکانهای نصب',
|
locations: 'مکانهای نصب',
|
||||||
catalog: 'کاتالوگ محصولات',
|
|
||||||
video: 'ویدیوی معرفی',
|
|
||||||
map: 'نقشه',
|
|
||||||
support: 'پشتیبانی',
|
|
||||||
contact: 'تماس با ما',
|
contact: 'تماس با ما',
|
||||||
login: 'ورود به پنل کاربری',
|
login: 'ورود به پنل کاربری',
|
||||||
},
|
},
|
||||||
@@ -140,7 +144,6 @@ export const content = {
|
|||||||
},
|
},
|
||||||
machineActions: {
|
machineActions: {
|
||||||
addToCart: 'افزودن به سبد خرید',
|
addToCart: 'افزودن به سبد خرید',
|
||||||
quickView: 'مشاهده سریع',
|
|
||||||
wishlistAdd: 'افزودن به علاقهمندیها',
|
wishlistAdd: 'افزودن به علاقهمندیها',
|
||||||
wishlistRemove: 'حذف از علاقهمندیها',
|
wishlistRemove: 'حذف از علاقهمندیها',
|
||||||
hoverHint: 'نشانگر را روی دستگاه حرکت دهید',
|
hoverHint: 'نشانگر را روی دستگاه حرکت دهید',
|
||||||
@@ -148,18 +151,6 @@ export const content = {
|
|||||||
gifAlt: (name) => `نمایش عملکرد ${name}`,
|
gifAlt: (name) => `نمایش عملکرد ${name}`,
|
||||||
},
|
},
|
||||||
machines: machinesFa,
|
machines: machinesFa,
|
||||||
trustedBy: {
|
|
||||||
eyebrow: 'اعتماد شما، افتخار ماست',
|
|
||||||
title: 'کسبوکارهایی که به روبات مارکت اعتماد کردهاند',
|
|
||||||
clients: [
|
|
||||||
{id: 'c1', name: 'هتل پارسیان'},
|
|
||||||
{id: 'c2', name: 'دانشگاه فردوسی'},
|
|
||||||
{id: 'c3', name: 'بیمارستان رضوی'},
|
|
||||||
{id: 'c4', name: 'فروشگاههای زنجیرهای رفاه'},
|
|
||||||
{id: 'c5', name: 'مجتمع اداری آسمان'},
|
|
||||||
{id: 'c6', name: 'باشگاه ورزشی تلاش'},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
features: [
|
features: [
|
||||||
{
|
{
|
||||||
id: 'warranty',
|
id: 'warranty',
|
||||||
@@ -243,114 +234,6 @@ export const content = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
catalog: {
|
|
||||||
eyebrow: 'کاتالوگ محصولات',
|
|
||||||
title: 'محصولات قابل سفارش برای دستگاه شما',
|
|
||||||
subtitle:
|
|
||||||
'با خرید دستگاه روبات مارکت، میتوانید این محصولات را با قیمت عمده و کمتر از بازار سفارش دهید؛ تیم ما هم چیدمان اولیه و شارژ دستگاه شما را انجام میدهد.',
|
|
||||||
addToOrder: 'افزودن به سفارش',
|
|
||||||
originalPriceLabel: 'قیمت بازار',
|
|
||||||
machinePriceLabel: 'قیمت ویژه مشتریان روبات مارکت',
|
|
||||||
addToast: (name) => `${name} به لیست سفارش اضافه شد`,
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
id: 'saffron',
|
|
||||||
name: 'زعفران ممتاز درجهیک',
|
|
||||||
category: 'زعفران',
|
|
||||||
image: '/images/catalog/saffron.svg',
|
|
||||||
originalPriceNumeric: 12000000,
|
|
||||||
priceNumeric: 8900000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'chips',
|
|
||||||
name: 'چیپس و پفک (بسته عمده)',
|
|
||||||
category: 'تنقلات',
|
|
||||||
image: '/images/snacks/chips-1.svg',
|
|
||||||
originalPriceNumeric: 450000,
|
|
||||||
priceNumeric: 320000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'soda',
|
|
||||||
name: 'نوشابه و نوشیدنی گازدار',
|
|
||||||
category: 'نوشیدنی',
|
|
||||||
image: '/images/snacks/soda-1.svg',
|
|
||||||
originalPriceNumeric: 250000,
|
|
||||||
priceNumeric: 180000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'water',
|
|
||||||
name: 'آب معدنی',
|
|
||||||
category: 'نوشیدنی',
|
|
||||||
image: '/images/catalog/water.svg',
|
|
||||||
originalPriceNumeric: 120000,
|
|
||||||
priceNumeric: 80000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coffee',
|
|
||||||
name: 'قهوه فوری',
|
|
||||||
category: 'گرم',
|
|
||||||
image: '/images/catalog/coffee.svg',
|
|
||||||
originalPriceNumeric: 650000,
|
|
||||||
priceNumeric: 470000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'tea',
|
|
||||||
name: 'چای کیسهای',
|
|
||||||
category: 'گرم',
|
|
||||||
image: '/images/catalog/tea.svg',
|
|
||||||
originalPriceNumeric: 380000,
|
|
||||||
priceNumeric: 270000
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
introVideo: {
|
|
||||||
eyebrow: 'ویدیوی معرفی',
|
|
||||||
title: 'با روبات مارکت آشنا شوید',
|
|
||||||
subtitle: 'نگاهی کوتاه به کارخانه، فرآیند تولید و عملکرد دستگاههای روبات مارکت.',
|
|
||||||
videoNotSupported: 'مرورگر شما از پخش ویدیو پشتیبانی نمیکند.',
|
|
||||||
},
|
|
||||||
map: {
|
|
||||||
eyebrow: 'موقعیت ما روی نقشه',
|
|
||||||
title: 'کارخانه و دفاتر روبات مارکت',
|
|
||||||
factoryLabel: 'کارخانه',
|
|
||||||
salesLabel: 'دفتر فروش مرکزی',
|
|
||||||
openInMaps: 'مشاهده در نشان',
|
|
||||||
configNotice: 'برای فعال شدن نقشه، کلید API نشان را در تنظیمات پروژه قرار دهید.',
|
|
||||||
},
|
|
||||||
ticket: {
|
|
||||||
eyebrow: 'پشتیبانی',
|
|
||||||
title: 'ثبت تیکت پشتیبانی',
|
|
||||||
subtitle: 'سوال یا درخواستی دارید؟ فرم زیر را پر کنید تا تیم پشتیبانی در سریعترین زمان با شما تماس بگیرد.',
|
|
||||||
name: 'نام و نام خانوادگی',
|
|
||||||
namePlaceholder: 'مثال: علی رضایی',
|
|
||||||
phone: 'شماره تماس',
|
|
||||||
phonePlaceholder: '09xxxxxxxxx',
|
|
||||||
email: 'ایمیل (اختیاری)',
|
|
||||||
emailPlaceholder: 'example@email.com',
|
|
||||||
subject: 'موضوع',
|
|
||||||
subjectPlaceholder: 'موضوع درخواست خود را بنویسید',
|
|
||||||
priority: 'اولویت',
|
|
||||||
priorities: [
|
|
||||||
{value: 'low', label: 'کم'},
|
|
||||||
{value: 'medium', label: 'متوسط'},
|
|
||||||
{value: 'high', label: 'فوری'},
|
|
||||||
],
|
|
||||||
message: 'پیام شما',
|
|
||||||
messagePlaceholder: 'توضیحات کامل درخواست یا مشکل خود را بنویسید…',
|
|
||||||
submit: 'ارسال تیکت',
|
|
||||||
requiredMsg: 'این فیلد الزامی است',
|
|
||||||
invalidPhone: 'شماره تماس معتبر نیست',
|
|
||||||
invalidEmail: 'ایمیل معتبر نیست',
|
|
||||||
successMsg: 'تیکت شما با موفقیت ثبت شد. بهزودی با شما تماس میگیریم.',
|
|
||||||
},
|
|
||||||
chat: {
|
|
||||||
fabLabel: 'گفتگوی آنلاین',
|
|
||||||
title: 'پشتیبانی آنلاین روبات مارکت',
|
|
||||||
placeholder: 'پیام خود را بنویسید…',
|
|
||||||
send: 'ارسال',
|
|
||||||
initialBotMessage: 'سلام! 👋 چطور میتونم امروز کمکتون کنم؟',
|
|
||||||
fallbackReply: 'ممنون از پیامتون؛ همکاران ما بهزودی پاسخ میدهند.',
|
|
||||||
},
|
|
||||||
footer: {
|
footer: {
|
||||||
aboutLabel: 'روبات مارکت',
|
aboutLabel: 'روبات مارکت',
|
||||||
aboutText: 'ارائهدهنده دستگاههای وندینگ هوشمند برای کسبوکارهای مدرن — محصولی از شرکت نگین سازان پیشگام رادمهر آتوسا.',
|
aboutText: 'ارائهدهنده دستگاههای وندینگ هوشمند برای کسبوکارهای مدرن — محصولی از شرکت نگین سازان پیشگام رادمهر آتوسا.',
|
||||||
@@ -386,10 +269,6 @@ export const content = {
|
|||||||
showcase: 'Machines',
|
showcase: 'Machines',
|
||||||
about: 'About Us',
|
about: 'About Us',
|
||||||
locations: 'Where to Install',
|
locations: 'Where to Install',
|
||||||
catalog: 'Product Catalog',
|
|
||||||
video: 'Intro Video',
|
|
||||||
map: 'Map',
|
|
||||||
support: 'Support',
|
|
||||||
contact: 'Contact',
|
contact: 'Contact',
|
||||||
login: 'Sign In',
|
login: 'Sign In',
|
||||||
},
|
},
|
||||||
@@ -430,7 +309,6 @@ export const content = {
|
|||||||
},
|
},
|
||||||
machineActions: {
|
machineActions: {
|
||||||
addToCart: 'Add to Cart',
|
addToCart: 'Add to Cart',
|
||||||
quickView: 'Quick View',
|
|
||||||
wishlistAdd: 'Add to Wishlist',
|
wishlistAdd: 'Add to Wishlist',
|
||||||
wishlistRemove: 'Remove from Wishlist',
|
wishlistRemove: 'Remove from Wishlist',
|
||||||
hoverHint: 'Move your cursor over the machine',
|
hoverHint: 'Move your cursor over the machine',
|
||||||
@@ -438,19 +316,6 @@ export const content = {
|
|||||||
gifAlt: (name) => `${name} in action`,
|
gifAlt: (name) => `${name} in action`,
|
||||||
},
|
},
|
||||||
machines: machinesEn,
|
machines: machinesEn,
|
||||||
trustedBy: {
|
|
||||||
eyebrow: 'Trusted by businesses like yours',
|
|
||||||
title: 'Businesses That Trust Robot Market',
|
|
||||||
// Sample/placeholder names — replace with real client names.
|
|
||||||
clients: [
|
|
||||||
{id: 'c1', name: 'Parsian Hotel'},
|
|
||||||
{id: 'c2', name: 'Ferdowsi University'},
|
|
||||||
{id: 'c3', name: 'Razavi Hospital'},
|
|
||||||
{id: 'c4', name: 'Refah Retail Chain'},
|
|
||||||
{id: 'c5', name: 'Asemaan Office Complex'},
|
|
||||||
{id: 'c6', name: 'Talash Sports Club'},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
features: [
|
features: [
|
||||||
{
|
{
|
||||||
id: 'warranty',
|
id: 'warranty',
|
||||||
@@ -534,114 +399,6 @@ export const content = {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
catalog: {
|
|
||||||
eyebrow: 'Product Catalog',
|
|
||||||
title: 'Products You Can Order for Your Machine',
|
|
||||||
subtitle:
|
|
||||||
'When you buy a Robot Market machine, you can order these products at a wholesale price below market rate — our team also handles the initial stocking and layout for you.',
|
|
||||||
addToOrder: 'Add to Order',
|
|
||||||
originalPriceLabel: 'Market price',
|
|
||||||
machinePriceLabel: 'Robot Market customer price',
|
|
||||||
addToast: (name) => `${name} added to your order`,
|
|
||||||
items: [
|
|
||||||
{
|
|
||||||
id: 'saffron',
|
|
||||||
name: 'Premium Grade-1 Saffron',
|
|
||||||
category: 'Saffron',
|
|
||||||
image: '/images/catalog/saffron.svg',
|
|
||||||
originalPriceNumeric: 12000000,
|
|
||||||
priceNumeric: 8900000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'chips',
|
|
||||||
name: 'Chips & Crisps (bulk pack)',
|
|
||||||
category: 'Snacks',
|
|
||||||
image: '/images/snacks/chips-1.svg',
|
|
||||||
originalPriceNumeric: 450000,
|
|
||||||
priceNumeric: 320000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'soda',
|
|
||||||
name: 'Soda & Carbonated Drinks',
|
|
||||||
category: 'Drinks',
|
|
||||||
image: '/images/snacks/soda-1.svg',
|
|
||||||
originalPriceNumeric: 250000,
|
|
||||||
priceNumeric: 180000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'water',
|
|
||||||
name: 'Mineral Water',
|
|
||||||
category: 'Drinks',
|
|
||||||
image: '/images/catalog/water.svg',
|
|
||||||
originalPriceNumeric: 120000,
|
|
||||||
priceNumeric: 80000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'coffee',
|
|
||||||
name: 'Instant Coffee',
|
|
||||||
category: 'Hot Drinks',
|
|
||||||
image: '/images/catalog/coffee.svg',
|
|
||||||
originalPriceNumeric: 650000,
|
|
||||||
priceNumeric: 470000
|
|
||||||
},
|
|
||||||
{
|
|
||||||
id: 'tea',
|
|
||||||
name: 'Tea Bags',
|
|
||||||
category: 'Hot Drinks',
|
|
||||||
image: '/images/catalog/tea.svg',
|
|
||||||
originalPriceNumeric: 380000,
|
|
||||||
priceNumeric: 270000
|
|
||||||
},
|
|
||||||
],
|
|
||||||
},
|
|
||||||
introVideo: {
|
|
||||||
eyebrow: 'Intro Video',
|
|
||||||
title: 'Get to Know Robot Market',
|
|
||||||
subtitle: 'A short look at the factory, our production process, and the machines in action.',
|
|
||||||
videoNotSupported: 'Your browser does not support video playback.',
|
|
||||||
},
|
|
||||||
map: {
|
|
||||||
eyebrow: 'Find Us on the Map',
|
|
||||||
title: 'Robot Market Factory & Offices',
|
|
||||||
factoryLabel: 'Factory',
|
|
||||||
salesLabel: 'Central Sales Office',
|
|
||||||
openInMaps: 'Open in Neshan',
|
|
||||||
configNotice: 'Add your Neshan API key in the project settings to activate the map.',
|
|
||||||
},
|
|
||||||
ticket: {
|
|
||||||
eyebrow: 'Support',
|
|
||||||
title: 'Submit a Support Ticket',
|
|
||||||
subtitle: 'Have a question or request? Fill out the form below and our support team will get back to you as soon as possible.',
|
|
||||||
name: 'Full Name',
|
|
||||||
namePlaceholder: 'e.g. John Smith',
|
|
||||||
phone: 'Phone Number',
|
|
||||||
phonePlaceholder: '09xxxxxxxxx',
|
|
||||||
email: 'Email (optional)',
|
|
||||||
emailPlaceholder: 'example@email.com',
|
|
||||||
subject: 'Subject',
|
|
||||||
subjectPlaceholder: 'Write the subject of your request',
|
|
||||||
priority: 'Priority',
|
|
||||||
priorities: [
|
|
||||||
{value: 'low', label: 'Low'},
|
|
||||||
{value: 'medium', label: 'Medium'},
|
|
||||||
{value: 'high', label: 'Urgent'},
|
|
||||||
],
|
|
||||||
message: 'Your Message',
|
|
||||||
messagePlaceholder: 'Describe your request or issue in full…',
|
|
||||||
submit: 'Submit Ticket',
|
|
||||||
requiredMsg: 'This field is required',
|
|
||||||
invalidPhone: 'Invalid phone number',
|
|
||||||
invalidEmail: 'Invalid email address',
|
|
||||||
successMsg: 'Your ticket was submitted successfully. We will contact you soon.',
|
|
||||||
},
|
|
||||||
chat: {
|
|
||||||
fabLabel: 'Live Chat',
|
|
||||||
title: 'Robot Market Live Support',
|
|
||||||
placeholder: 'Type your message…',
|
|
||||||
send: 'Send',
|
|
||||||
initialBotMessage: "Hi! 👋 How can we help you today?",
|
|
||||||
fallbackReply: "Thanks for your message — our team will reply shortly.",
|
|
||||||
},
|
|
||||||
footer: {
|
footer: {
|
||||||
aboutLabel: 'Robot Market',
|
aboutLabel: 'Robot Market',
|
||||||
aboutText: 'Smart vending machines for modern businesses — a product of Negin Sazan Pishgam Radmehr Atousa Co.',
|
aboutText: 'Smart vending machines for modern businesses — a product of Negin Sazan Pishgam Radmehr Atousa Co.',
|
||||||
@@ -666,7 +423,7 @@ export const content = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Locale-independent asset config (positions/paths only — same in both languages).
|
// Locale-independent asset config (positions/paths only — same in both languages).
|
||||||
export const floatingSnacks = [
|
export const floatingSnacks: FloatingSnack[] = [
|
||||||
{id: 'chips-1', image: '/images/snacks/item-1.webp', size: 60, top: '5%', left: '-5%', duration: 5.5, delay: 0},
|
{id: 'chips-1', image: '/images/snacks/item-1.webp', size: 60, top: '5%', left: '-5%', duration: 5.5, delay: 0},
|
||||||
{id: 'soda-1', image: '/images/snacks/item-2.webp', size: 55, top: '68%', left: '2%', duration: 6.2, delay: 0.6},
|
{id: 'soda-1', image: '/images/snacks/item-2.webp', size: 55, top: '68%', left: '2%', duration: 6.2, delay: 0.6},
|
||||||
{id: 'chips-2', image: '/images/snacks/item-3.webp', size: 65, top: '10%', left: '85%', duration: 4.8, delay: 0.3},
|
{id: 'chips-2', image: '/images/snacks/item-3.webp', size: 65, top: '10%', left: '85%', duration: 4.8, delay: 0.3},
|
||||||
@@ -676,15 +433,3 @@ export const floatingSnacks = [
|
|||||||
];
|
];
|
||||||
|
|
||||||
export const showcaseVideoSrc = '/video/showcase-placeholder.mp4';
|
export const showcaseVideoSrc = '/video/showcase-placeholder.mp4';
|
||||||
|
|
||||||
// Dedicated company introduction video (different from the horizontal-showcase
|
|
||||||
// scroll-scrubbed background video above). Drop the real file at this path.
|
|
||||||
export const introVideoSrc = '/video/company-intro-placeholder.mp4';
|
|
||||||
export const introVideoPoster = '/images/video-poster.svg';
|
|
||||||
|
|
||||||
// Placeholder coordinates for Toos Industrial Town, Mashhad (approximate).
|
|
||||||
// Replace with the exact factory pin — see README.
|
|
||||||
export const mapLocations = {
|
|
||||||
factory: {lat: 36.42, lng: 59.445},
|
|
||||||
salesOffice: {lat: 36.3110, lng: 59.5683}, // approximate central Mashhad placeholder
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
import type {Locale, Machine, ProductCategory} from '@/types/domain';
|
||||||
|
|
||||||
|
export const productCategories: {id: ProductCategory; label: Record<Locale, string>}[] = [
|
||||||
|
{id: 'warm-vending', label: {fa: 'وندینگ گرم', en: 'Warm vending'}},
|
||||||
|
];
|
||||||
|
|
||||||
|
// Keep the home showcase independent of future catalog additions.
|
||||||
|
const featuredIds = ['rm-35', 'rm-48', 'rm-60'];
|
||||||
|
|
||||||
|
export function featuredMachines(machines: Machine[]): Machine[] {
|
||||||
|
return featuredIds.flatMap(id => machines.filter(machine => machine.id === id));
|
||||||
|
}
|
||||||
|
|
||||||
|
export function filterMachines(machines: Machine[], category: string): Machine[] {
|
||||||
|
return category ? machines.filter(machine => machine.category === category) : machines;
|
||||||
|
}
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
{
|
|
||||||
"compilerOptions": {
|
|
||||||
"baseUrl": ".",
|
|
||||||
"paths": {
|
|
||||||
"@/*": ["./*"]
|
|
||||||
},
|
|
||||||
"jsx": "react"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -43,11 +43,11 @@ api.interceptors.response.use(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (status >= 500) {
|
if (status >= 500) {
|
||||||
// message.error('خطایی در سرور رخ داد. لطفاً بعداً تلاش کنید.');
|
// TODO: Display a server error message.
|
||||||
}
|
}
|
||||||
} else if (error.request) {
|
} else if (error.request) {
|
||||||
// درخواست ارسال شد ولی هیچ جوابی نیومد (قطعی اینترنت، سرور خاموش و ...)
|
// The request was sent, but no response arrived.
|
||||||
// TODO: message.error('اتصال با سرور برقرار نشد.');
|
// TODO: Display a network connection error.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
/// <reference types="next" />
|
||||||
|
/// <reference types="next/image-types/global" />
|
||||||
|
|
||||||
|
// NOTE: This file should not be edited
|
||||||
|
// see https://nextjs.org/docs/basic-features/typescript for more information.
|
||||||
@@ -1,5 +1,7 @@
|
|||||||
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
|
const basePath = process.env.NEXT_PUBLIC_BASE_PATH || '';
|
||||||
|
|
||||||
|
// Next.js 14 loads its configuration as JavaScript.
|
||||||
|
/** @type {import('next').NextConfig} */
|
||||||
const nextConfig = {
|
const nextConfig = {
|
||||||
reactStrictMode: true,
|
reactStrictMode: true,
|
||||||
|
|
||||||
|
|||||||
@@ -19,9 +19,13 @@
|
|||||||
"react-redux": "9.1.2"
|
"react-redux": "9.1.2"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "20.19.43",
|
||||||
|
"@types/react": "18.3.31",
|
||||||
|
"@types/react-dom": "18.3.7",
|
||||||
"autoprefixer": "10.4.19",
|
"autoprefixer": "10.4.19",
|
||||||
"postcss": "8.4.39",
|
"postcss": "8.4.39",
|
||||||
"tailwindcss": "3.4.6"
|
"tailwindcss": "3.4.6",
|
||||||
|
"typescript": "5.9.3"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@alloc/quick-lru": {
|
"node_modules/@alloc/quick-lru": {
|
||||||
@@ -576,6 +580,44 @@
|
|||||||
"tslib": "^2.4.0"
|
"tslib": "^2.4.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@types/node": {
|
||||||
|
"version": "20.19.43",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.19.43.tgz",
|
||||||
|
"integrity": "sha512-6oYBAi5ikg4Pl+kGsoYtawUMBT2zZMCvPNF7pVLnHZfd1zf38DRiWn/gT01RYCdUqkv7Fhr+C9ot4/tb+2sVvA==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"undici-types": "~6.21.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/prop-types": {
|
||||||
|
"version": "15.7.15",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.15.tgz",
|
||||||
|
"integrity": "sha512-F6bEyamV9jKGAFBEmlQnesRPGOQqS2+Uwi0Em15xenOxHaf2hv6L8YCVn3rPdPJOiJfPiCnLIRyvwVaqMY3MIw==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
|
"node_modules/@types/react": {
|
||||||
|
"version": "18.3.31",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.31.tgz",
|
||||||
|
"integrity": "sha512-vfEqpXTvwT91yhmwdfouStN2hSKwTvyRs8qpLfADyrq/kxDw0hZM7Wk9Ug1FELj8hIby+S/+kQCSRFF32nv2Qw==",
|
||||||
|
"devOptional": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"dependencies": {
|
||||||
|
"@types/prop-types": "*",
|
||||||
|
"csstype": "^3.2.2"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@types/react-dom": {
|
||||||
|
"version": "18.3.7",
|
||||||
|
"resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-18.3.7.tgz",
|
||||||
|
"integrity": "sha512-MEe3UeoENYVFXzoXEWsvcpg6ZvlrFNlOQ7EOsvhI3CfAXwzPfO8Qwuxd40nepsYKqyyVQnTdEfv68q91yLcKrQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT",
|
||||||
|
"peerDependencies": {
|
||||||
|
"@types/react": "^18.0.0"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@types/use-sync-external-store": {
|
"node_modules/@types/use-sync-external-store": {
|
||||||
"version": "0.0.3",
|
"version": "0.0.3",
|
||||||
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz",
|
"resolved": "https://registry.npmjs.org/@types/use-sync-external-store/-/use-sync-external-store-0.0.3.tgz",
|
||||||
@@ -2917,6 +2959,27 @@
|
|||||||
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
|
||||||
"license": "0BSD"
|
"license": "0BSD"
|
||||||
},
|
},
|
||||||
|
"node_modules/typescript": {
|
||||||
|
"version": "5.9.3",
|
||||||
|
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.9.3.tgz",
|
||||||
|
"integrity": "sha512-jl1vZzPDinLr9eUt3J/t7V6FgNEw9QjvBPdysz9KfQDD41fQrC2Y4vKQdiaUpFT4bXlb1RHhLpp8wtm6M5TgSw==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "Apache-2.0",
|
||||||
|
"bin": {
|
||||||
|
"tsc": "bin/tsc",
|
||||||
|
"tsserver": "bin/tsserver"
|
||||||
|
},
|
||||||
|
"engines": {
|
||||||
|
"node": ">=14.17"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/undici-types": {
|
||||||
|
"version": "6.21.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.21.0.tgz",
|
||||||
|
"integrity": "sha512-iwDZqg0QAGrg9Rav5H4n0M64c3mkR59cJ6wQp+7C4nI0gsmExaedaYLNO44eT4AtBBwjbTiGPMlt2Md0T9H9JQ==",
|
||||||
|
"dev": true,
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/update-browserslist-db": {
|
"node_modules/update-browserslist-db": {
|
||||||
"version": "1.2.3",
|
"version": "1.2.3",
|
||||||
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
"resolved": "https://registry.npmjs.org/update-browserslist-db/-/update-browserslist-db-1.2.3.tgz",
|
||||||
|
|||||||
@@ -6,22 +6,27 @@
|
|||||||
"dev": "next dev -H 0.0.0.0",
|
"dev": "next dev -H 0.0.0.0",
|
||||||
"build": "next build",
|
"build": "next build",
|
||||||
"start": "next start",
|
"start": "next start",
|
||||||
"lint": "next lint"
|
"lint": "next lint",
|
||||||
|
"typecheck": "tsc --noEmit"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@ant-design/icons": "5.3.7",
|
||||||
|
"@reduxjs/toolkit": "2.2.7",
|
||||||
|
"antd": "5.19.1",
|
||||||
|
"axios": "1.7.2",
|
||||||
|
"gsap": "3.12.5",
|
||||||
"next": "14.2.5",
|
"next": "14.2.5",
|
||||||
"react": "18.3.1",
|
"react": "18.3.1",
|
||||||
"react-dom": "18.3.1",
|
"react-dom": "18.3.1",
|
||||||
"antd": "5.19.1",
|
"react-redux": "9.1.2"
|
||||||
"@ant-design/icons": "5.3.7",
|
|
||||||
"@reduxjs/toolkit": "2.2.7",
|
|
||||||
"react-redux": "9.1.2",
|
|
||||||
"axios": "1.7.2",
|
|
||||||
"gsap": "3.12.5"
|
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/node": "20.19.43",
|
||||||
|
"@types/react": "18.3.31",
|
||||||
|
"@types/react-dom": "18.3.7",
|
||||||
"autoprefixer": "10.4.19",
|
"autoprefixer": "10.4.19",
|
||||||
"postcss": "8.4.39",
|
"postcss": "8.4.39",
|
||||||
"tailwindcss": "3.4.6"
|
"tailwindcss": "3.4.6",
|
||||||
|
"typescript": "5.9.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 140 120" width="140" height="120">
|
|
||||||
<rect x="20" y="30" width="80" height="70" rx="8" fill="#6b3f2a" stroke="#3a1f13" stroke-width="3"/>
|
|
||||||
<path d="M100 45 q22 0 22 20 q0 20 -22 20" fill="none" stroke="#3a1f13" stroke-width="6"/>
|
|
||||||
<ellipse cx="60" cy="30" rx="40" ry="10" fill="#c8a27a"/>
|
|
||||||
<text x="60" y="72" font-family="Tahoma, sans-serif" font-size="12" fill="#ffe9d6" text-anchor="middle">قهوه</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 473 B |
@@ -1,6 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 140" width="120" height="140">
|
|
||||||
<rect x="15" y="20" width="90" height="105" rx="10" fill="#7a1f2b" stroke="#3d0f15" stroke-width="3"/>
|
|
||||||
<rect x="15" y="20" width="90" height="34" rx="10" fill="#00a693"/>
|
|
||||||
<path d="M40 70 q10 -14 20 0 q10 -14 20 0" stroke="#ffcf4d" stroke-width="3" fill="none"/>
|
|
||||||
<text x="60" y="100" font-family="Tahoma, sans-serif" font-size="13" fill="#ffe9b0" text-anchor="middle">زعفران</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 490 B |
@@ -1,6 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 120 140" width="120" height="140">
|
|
||||||
<rect x="20" y="25" width="80" height="95" rx="6" fill="#00a693" stroke="#017065" stroke-width="3"/>
|
|
||||||
<rect x="30" y="15" width="60" height="16" rx="4" fill="#e6f7f4"/>
|
|
||||||
<line x1="60" y1="0" x2="60" y2="15" stroke="#8fdccc" stroke-width="2"/>
|
|
||||||
<text x="60" y="80" font-family="Tahoma, sans-serif" font-size="13" fill="#e6f7f4" text-anchor="middle">چای</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 462 B |
@@ -1,5 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 160" width="90" height="160">
|
|
||||||
<path d="M30 10 h30 v18 l8 10 v100 a6 6 0 0 1 -6 6 h-34 a6 6 0 0 1 -6 -6 v-100 l8 -10 z" fill="#bfe9ff" stroke="#00a693" stroke-width="3"/>
|
|
||||||
<rect x="26" y="70" width="38" height="30" fill="#ffffff" opacity="0.85"/>
|
|
||||||
<text x="45" y="90" font-family="Tahoma, sans-serif" font-size="11" fill="#017065" text-anchor="middle">آب</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 430 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#00a693"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">پ</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#017065"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">ف</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#00a693"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">ر</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#0b3d38"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">ر</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#00a693"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">آ</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
@@ -1,7 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 200 80" width="200" height="80">
|
|
||||||
<rect x="2" y="2" width="196" height="76" rx="12" fill="none" stroke="#00a693" stroke-opacity="0.3" stroke-width="2"/>
|
|
||||||
<circle cx="40" cy="40" r="20" fill="#017065"/>
|
|
||||||
<text x="40" y="47" font-family="Tahoma, sans-serif" font-size="20" font-weight="bold" fill="#ffffff" text-anchor="middle">ت</text>
|
|
||||||
<rect x="72" y="32" width="100" height="8" rx="4" fill="#00a693" fill-opacity="0.35"/>
|
|
||||||
<rect x="72" y="46" width="70" height="6" rx="3" fill="#00a693" fill-opacity="0.2"/>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 575 B |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 273 KiB |
|
Before Width: | Height: | Size: 354 KiB After Width: | Height: | Size: 1.1 MiB |
@@ -1,12 +0,0 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1280 720" width="1280" height="720">
|
|
||||||
<defs>
|
|
||||||
<linearGradient id="posterBg" x1="0" y1="0" x2="1" y2="1">
|
|
||||||
<stop offset="0" stop-color="#0b3d38"/>
|
|
||||||
<stop offset="1" stop-color="#04120f"/>
|
|
||||||
</linearGradient>
|
|
||||||
</defs>
|
|
||||||
<rect width="1280" height="720" fill="url(#posterBg)"/>
|
|
||||||
<circle cx="640" cy="360" r="70" fill="#00a693" opacity="0.9"/>
|
|
||||||
<path d="M615 325 l70 35 l-70 35 z" fill="#04120f"/>
|
|
||||||
<text x="640" y="480" font-family="Tahoma, sans-serif" font-size="30" fill="#e6f7f4" text-anchor="middle">ویدیوی معرفی روبات مارکت — placeholder</text>
|
|
||||||
</svg>
|
|
||||||
|
Before Width: | Height: | Size: 649 B |
@@ -1,15 +1,20 @@
|
|||||||
|
import type {PayloadAction} from '@reduxjs/toolkit';
|
||||||
|
import type {CartItem, CartProduct, CartState} from '@/types/domain';
|
||||||
|
import type {RootState} from './store';
|
||||||
import { createSlice } from '@reduxjs/toolkit';
|
import { createSlice } from '@reduxjs/toolkit';
|
||||||
|
|
||||||
const initialState = {
|
const initialState: CartState = {
|
||||||
items: [], // { id, name, priceNumeric, priceLabel, qty, image }
|
items: [], // { id, name, priceNumeric, priceLabel, qty, image }
|
||||||
isDrawerOpen: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const cartSlice = createSlice({
|
const cartSlice = createSlice({
|
||||||
name: 'cart',
|
name: 'cart',
|
||||||
initialState,
|
initialState,
|
||||||
reducers: {
|
reducers: {
|
||||||
addToCart: (state, action) => {
|
restoreCart: (state, action: PayloadAction<CartItem[]>) => {
|
||||||
|
state.items = action.payload;
|
||||||
|
},
|
||||||
|
addToCart: (state, action: PayloadAction<CartProduct>) => {
|
||||||
const product = action.payload;
|
const product = action.payload;
|
||||||
const existing = state.items.find((item) => item.id === product.id);
|
const existing = state.items.find((item) => item.id === product.id);
|
||||||
if (existing) {
|
if (existing) {
|
||||||
@@ -17,16 +22,21 @@ const cartSlice = createSlice({
|
|||||||
} else {
|
} else {
|
||||||
state.items.push({ ...product, qty: 1 });
|
state.items.push({ ...product, qty: 1 });
|
||||||
}
|
}
|
||||||
state.isDrawerOpen = true;
|
|
||||||
},
|
},
|
||||||
removeFromCart: (state, action) => {
|
removeFromCart: (state, action: PayloadAction<string>) => {
|
||||||
state.items = state.items.filter((item) => item.id !== action.payload);
|
state.items = state.items.filter((item) => item.id !== action.payload);
|
||||||
},
|
},
|
||||||
incrementQty: (state, action) => {
|
setQuantity: (state, action: PayloadAction<{id: string; qty: number}>) => {
|
||||||
|
const { id, qty } = action.payload;
|
||||||
|
if (!Number.isSafeInteger(qty) || qty < 1) return;
|
||||||
|
const item = state.items.find((item) => item.id === id);
|
||||||
|
if (item) item.qty = qty;
|
||||||
|
},
|
||||||
|
incrementQty: (state, action: PayloadAction<string>) => {
|
||||||
const item = state.items.find((item) => item.id === action.payload);
|
const item = state.items.find((item) => item.id === action.payload);
|
||||||
if (item) item.qty += 1;
|
if (item) item.qty += 1;
|
||||||
},
|
},
|
||||||
decrementQty: (state, action) => {
|
decrementQty: (state, action: PayloadAction<string>) => {
|
||||||
const item = state.items.find((item) => item.id === action.payload);
|
const item = state.items.find((item) => item.id === action.payload);
|
||||||
if (item && item.qty > 1) {
|
if (item && item.qty > 1) {
|
||||||
item.qty -= 1;
|
item.qty -= 1;
|
||||||
@@ -37,35 +47,24 @@ const cartSlice = createSlice({
|
|||||||
clearCart: (state) => {
|
clearCart: (state) => {
|
||||||
state.items = [];
|
state.items = [];
|
||||||
},
|
},
|
||||||
openDrawer: (state) => {
|
|
||||||
state.isDrawerOpen = true;
|
|
||||||
},
|
|
||||||
closeDrawer: (state) => {
|
|
||||||
state.isDrawerOpen = false;
|
|
||||||
},
|
|
||||||
toggleDrawer: (state) => {
|
|
||||||
state.isDrawerOpen = !state.isDrawerOpen;
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
||||||
export const {
|
export const {
|
||||||
|
restoreCart,
|
||||||
addToCart,
|
addToCart,
|
||||||
removeFromCart,
|
removeFromCart,
|
||||||
|
setQuantity,
|
||||||
incrementQty,
|
incrementQty,
|
||||||
decrementQty,
|
decrementQty,
|
||||||
clearCart,
|
clearCart,
|
||||||
openDrawer,
|
|
||||||
closeDrawer,
|
|
||||||
toggleDrawer,
|
|
||||||
} = cartSlice.actions;
|
} = cartSlice.actions;
|
||||||
|
|
||||||
// Selectors
|
// Selectors
|
||||||
export const selectCartItems = (state) => state.cart.items;
|
export const selectCartItems = (state: RootState) => state.cart.items;
|
||||||
export const selectCartCount = (state) =>
|
export const selectCartCount = (state: RootState) =>
|
||||||
state.cart.items.reduce((sum, item) => sum + item.qty, 0);
|
state.cart.items.reduce((sum, item) => sum + item.qty, 0);
|
||||||
export const selectCartTotal = (state) =>
|
export const selectCartTotal = (state: RootState) =>
|
||||||
state.cart.items.reduce((sum, item) => sum + item.qty * item.priceNumeric, 0);
|
state.cart.items.reduce((sum, item) => sum + item.qty * item.priceNumeric, 0);
|
||||||
export const selectIsDrawerOpen = (state) => state.cart.isDrawerOpen;
|
|
||||||
|
|
||||||
export default cartSlice.reducer;
|
export default cartSlice.reducer;
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
'use client';
|
||||||
|
|
||||||
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
import type { AppDispatch, RootState } from './store';
|
||||||
|
|
||||||
|
export const useAppDispatch = useDispatch.withTypes<AppDispatch>();
|
||||||
|
export const useAppSelector = useSelector.withTypes<RootState>();
|
||||||
@@ -10,3 +10,7 @@ export const makeStore = () =>
|
|||||||
|
|
||||||
// Singleton store for the client (App Router renders providers on the client tree).
|
// Singleton store for the client (App Router renders providers on the client tree).
|
||||||
export const store = makeStore();
|
export const store = makeStore();
|
||||||
|
|
||||||
|
export type AppStore = ReturnType<typeof makeStore>;
|
||||||
|
export type RootState = ReturnType<AppStore["getState"]>;
|
||||||
|
export type AppDispatch = AppStore["dispatch"];
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
/** @type {import('tailwindcss').Config} */
|
import type {Config} from 'tailwindcss';
|
||||||
module.exports = {
|
const config: Config = {
|
||||||
darkMode: 'class',
|
darkMode: 'class',
|
||||||
content: [
|
content: [
|
||||||
'./app/**/*.{js,jsx,ts,tsx}',
|
'./app/**/*.{js,jsx,ts,tsx}',
|
||||||
@@ -55,3 +55,5 @@ module.exports = {
|
|||||||
preflight: true,
|
preflight: true,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export default config;
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ES2017",
|
||||||
|
"lib": ["dom", "dom.iterable", "esnext"],
|
||||||
|
"allowJs": false,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"strict": true,
|
||||||
|
"noEmit": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"module": "esnext",
|
||||||
|
"moduleResolution": "bundler",
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"jsx": "preserve",
|
||||||
|
"incremental": true,
|
||||||
|
"plugins": [{ "name": "next" }],
|
||||||
|
"baseUrl": ".",
|
||||||
|
"paths": { "@/*": ["./*"] }
|
||||||
|
},
|
||||||
|
"include": ["next-env.d.ts", "app/**/*.ts", "app/**/*.tsx", "components/**/*.tsx", "data/**/*.ts", "lib/**/*.ts", "store/**/*.ts", "types/**/*.ts", "tailwind.config.ts", ".next/types/**/*.ts"],
|
||||||
|
"exclude": ["node_modules", "docs", "out"]
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
export type Locale = 'fa' | 'en';
|
||||||
|
export type Direction = 'rtl' | 'ltr';
|
||||||
|
export type Theme = 'light' | 'dark';
|
||||||
|
export type ProductCategory = 'warm-vending';
|
||||||
|
|
||||||
|
export interface Machine {
|
||||||
|
id: string;
|
||||||
|
category: ProductCategory;
|
||||||
|
name: string;
|
||||||
|
shortLabel: string;
|
||||||
|
priceLabel: string;
|
||||||
|
priceNumeric: number;
|
||||||
|
description: string;
|
||||||
|
highlights: string[];
|
||||||
|
image: string;
|
||||||
|
imageAlt: string;
|
||||||
|
gif: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type CartProduct = Pick<Machine, 'id' | 'name' | 'priceNumeric' | 'priceLabel' | 'image'>;
|
||||||
|
export interface CartItem extends CartProduct { qty: number }
|
||||||
|
export interface CartState { items: CartItem[] }
|
||||||
|
|
||||||
|
export interface FloatingSnack {
|
||||||
|
id: string;
|
||||||
|
image: string;
|
||||||
|
size: number;
|
||||||
|
top: string;
|
||||||
|
left: string;
|
||||||
|
duration: number;
|
||||||
|
delay: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export type FeatureIcon = 'safety' | 'consulting' | 'installment' | 'packaging';
|
||||||
|
export type LocationIcon = 'hotel' | 'school' | 'pharmacy' | 'hospital' | 'night' | 'specialty';
|
||||||
|
|
||||||
|
interface InfoCard<Icon extends string> {
|
||||||
|
id: string;
|
||||||
|
icon: Icon;
|
||||||
|
title: string;
|
||||||
|
description: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface SiteContent {
|
||||||
|
dir: Direction;
|
||||||
|
lang: Locale;
|
||||||
|
meta: { title: string; description: string };
|
||||||
|
nav: Record<'home' | 'showcase' | 'about' | 'locations' | 'contact' | 'login', string>;
|
||||||
|
hero: {
|
||||||
|
loading: string;
|
||||||
|
cta: string;
|
||||||
|
slides: { id: string; kicker: string; titleLines: string[]; sub: string; image: string }[];
|
||||||
|
};
|
||||||
|
cart: {
|
||||||
|
title: string;
|
||||||
|
empty: string;
|
||||||
|
total: string;
|
||||||
|
checkout: string;
|
||||||
|
checkoutToast: string;
|
||||||
|
addToast: (name: string) => string;
|
||||||
|
};
|
||||||
|
machineActions: {
|
||||||
|
addToCart: string;
|
||||||
|
wishlistAdd: string;
|
||||||
|
wishlistRemove: string;
|
||||||
|
hoverHint: string;
|
||||||
|
altVariant: string;
|
||||||
|
gifAlt: (name: string) => string;
|
||||||
|
};
|
||||||
|
machines: Machine[];
|
||||||
|
features: InfoCard<FeatureIcon>[];
|
||||||
|
about: { eyebrow: string; legalName: string; more: string; less: string; paragraphs: string[] };
|
||||||
|
locations: { title: string; items: InfoCard<LocationIcon>[] };
|
||||||
|
footer: Record<'aboutLabel' | 'aboutText' | 'quickLinks' | 'contactTitle' | 'factoryLabel' | 'salesLabel' | 'rights', string>;
|
||||||
|
contactInfo: {
|
||||||
|
orderPhone: string;
|
||||||
|
orderPhoneHref: string;
|
||||||
|
factoryAddress: string;
|
||||||
|
salesOfficeAddress: string;
|
||||||
|
socialLinks: { id: string; label: string; href: string }[];
|
||||||
|
};
|
||||||
|
}
|
||||||