docs: add consolidated dev URL reference and migrate /shop to /storefront
Some checks failed
Some checks failed
- Add Development URL Quick Reference section to url-routing overview with all login URLs, entry points, and full examples - Replace /shop/ path segments with /storefront/ across 50 docs files - Update file references: shop_pages.py → storefront_pages.py, templates/shop/ → templates/storefront/, api/v1/shop/ → api/v1/storefront/ - Preserve domain references (orion.shop) and /store/ staff dashboard paths - Archive docs left unchanged (historical) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -56,7 +56,7 @@ CREATE TABLE store_themes (
|
||||
store_id INTEGER UNIQUE NOT NULL REFERENCES stores(id) ON DELETE CASCADE,
|
||||
theme_name VARCHAR(100) DEFAULT 'default',
|
||||
is_active BOOLEAN DEFAULT TRUE,
|
||||
|
||||
|
||||
-- Colors (JSON)
|
||||
colors JSONB DEFAULT '{
|
||||
"primary": "#6366f1",
|
||||
@@ -66,30 +66,30 @@ CREATE TABLE store_themes (
|
||||
"text": "#1f2937",
|
||||
"border": "#e5e7eb"
|
||||
}'::jsonb,
|
||||
|
||||
|
||||
-- Typography
|
||||
font_family_heading VARCHAR(100) DEFAULT 'Inter, sans-serif',
|
||||
font_family_body VARCHAR(100) DEFAULT 'Inter, sans-serif',
|
||||
|
||||
|
||||
-- Branding
|
||||
logo_url VARCHAR(500),
|
||||
logo_dark_url VARCHAR(500),
|
||||
favicon_url VARCHAR(500),
|
||||
banner_url VARCHAR(500),
|
||||
|
||||
|
||||
-- Layout
|
||||
layout_style VARCHAR(50) DEFAULT 'grid',
|
||||
header_style VARCHAR(50) DEFAULT 'fixed',
|
||||
product_card_style VARCHAR(50) DEFAULT 'modern',
|
||||
|
||||
|
||||
-- Customization
|
||||
custom_css TEXT,
|
||||
social_links JSONB DEFAULT '{}'::jsonb,
|
||||
|
||||
|
||||
-- Meta
|
||||
meta_title_template VARCHAR(200),
|
||||
meta_description TEXT,
|
||||
|
||||
|
||||
-- Timestamps
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW()
|
||||
@@ -122,7 +122,7 @@ from sqlalchemy.orm import relationship
|
||||
|
||||
class Store(Base):
|
||||
# ... existing fields ...
|
||||
|
||||
|
||||
# Add theme relationship
|
||||
theme = relationship(
|
||||
"StoreTheme",
|
||||
@@ -130,7 +130,7 @@ class Store(Base):
|
||||
uselist=False, # One-to-one relationship
|
||||
cascade="all, delete-orphan"
|
||||
)
|
||||
|
||||
|
||||
@property
|
||||
def active_theme(self):
|
||||
"""Get store's active theme or return None"""
|
||||
@@ -161,7 +161,7 @@ app.middleware("http")(theme_context_middleware)
|
||||
|
||||
### Step 5: Create Shop Base Template
|
||||
|
||||
File: `app/templates/shop/base.html`
|
||||
File: `app/templates/storefront/base.html`
|
||||
|
||||
See complete template in `/home/claude/shop_base_template.html`
|
||||
|
||||
@@ -184,7 +184,7 @@ See complete template in `/home/claude/shop_base_template.html`
|
||||
|
||||
### Step 6: Create Shop Layout JavaScript
|
||||
|
||||
File: `static/shop/js/shop-layout.js`
|
||||
File: `static/storefront/js/shop-layout.js`
|
||||
|
||||
See complete code in `/home/claude/shop_layout.js`
|
||||
|
||||
@@ -208,13 +208,13 @@ from middleware.theme_context import get_current_theme
|
||||
async def shop_home(request: Request, db: Session = Depends(get_db)):
|
||||
store = request.state.store
|
||||
theme = get_current_theme(request) # or request.state.theme
|
||||
|
||||
|
||||
# Get products for store
|
||||
products = db.query(Product).filter(
|
||||
Product.store_id == store.id,
|
||||
Product.is_active == True
|
||||
).all()
|
||||
|
||||
|
||||
return templates.TemplateResponse("shop/home.html", {
|
||||
"request": request,
|
||||
"store": store,
|
||||
@@ -308,7 +308,7 @@ theme = {
|
||||
border-radius: 12px;
|
||||
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
|
||||
.product-card:hover {
|
||||
transform: translateY(-4px);
|
||||
box-shadow: 0 8px 12px rgba(0, 0, 0, 0.15);
|
||||
@@ -340,7 +340,7 @@ THEME_PRESETS = {
|
||||
"header": "fixed"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"classic": {
|
||||
"colors": {
|
||||
"primary": "#1e40af",
|
||||
@@ -356,7 +356,7 @@ THEME_PRESETS = {
|
||||
"header": "static"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"minimal": {
|
||||
"colors": {
|
||||
"primary": "#000000",
|
||||
@@ -372,7 +372,7 @@ THEME_PRESETS = {
|
||||
"header": "transparent"
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
"vibrant": {
|
||||
"colors": {
|
||||
"primary": "#f59e0b",
|
||||
@@ -394,16 +394,16 @@ def apply_preset(theme: StoreTheme, preset_name: str):
|
||||
"""Apply a preset to a store theme"""
|
||||
if preset_name not in THEME_PRESETS:
|
||||
raise ValueError(f"Unknown preset: {preset_name}")
|
||||
|
||||
|
||||
preset = THEME_PRESETS[preset_name]
|
||||
|
||||
|
||||
theme.theme_name = preset_name
|
||||
theme.colors = preset["colors"]
|
||||
theme.font_family_heading = preset["fonts"]["heading"]
|
||||
theme.font_family_body = preset["fonts"]["body"]
|
||||
theme.layout_style = preset["layout"]["style"]
|
||||
theme.header_style = preset["layout"]["header"]
|
||||
|
||||
|
||||
return theme
|
||||
```
|
||||
|
||||
@@ -420,11 +420,11 @@ def get_store_theme(store_id: int, db: Session = Depends(get_db)):
|
||||
theme = db.query(StoreTheme).filter(
|
||||
StoreTheme.store_id == store_id
|
||||
).first()
|
||||
|
||||
|
||||
if not theme:
|
||||
# Return default theme
|
||||
return get_default_theme()
|
||||
|
||||
|
||||
return theme.to_dict()
|
||||
|
||||
|
||||
@@ -435,38 +435,38 @@ def update_store_theme(
|
||||
db: Session = Depends(get_db)
|
||||
):
|
||||
"""Update or create theme for store"""
|
||||
|
||||
|
||||
theme = db.query(StoreTheme).filter(
|
||||
StoreTheme.store_id == store_id
|
||||
).first()
|
||||
|
||||
|
||||
if not theme:
|
||||
theme = StoreTheme(store_id=store_id)
|
||||
db.add(theme)
|
||||
|
||||
|
||||
# Update fields
|
||||
if "colors" in theme_data:
|
||||
theme.colors = theme_data["colors"]
|
||||
|
||||
|
||||
if "fonts" in theme_data:
|
||||
theme.font_family_heading = theme_data["fonts"].get("heading")
|
||||
theme.font_family_body = theme_data["fonts"].get("body")
|
||||
|
||||
|
||||
if "branding" in theme_data:
|
||||
theme.logo_url = theme_data["branding"].get("logo")
|
||||
theme.logo_dark_url = theme_data["branding"].get("logo_dark")
|
||||
theme.favicon_url = theme_data["branding"].get("favicon")
|
||||
|
||||
|
||||
if "layout" in theme_data:
|
||||
theme.layout_style = theme_data["layout"].get("style")
|
||||
theme.header_style = theme_data["layout"].get("header")
|
||||
|
||||
|
||||
if "custom_css" in theme_data:
|
||||
theme.custom_css = theme_data["custom_css"]
|
||||
|
||||
|
||||
db.commit()
|
||||
db.refresh(theme)
|
||||
|
||||
|
||||
return theme.to_dict()
|
||||
|
||||
|
||||
@@ -478,22 +478,22 @@ def apply_theme_preset(
|
||||
):
|
||||
"""Apply a preset theme to store"""
|
||||
from app.core.theme_presets import apply_preset, THEME_PRESETS
|
||||
|
||||
|
||||
if preset_name not in THEME_PRESETS:
|
||||
raise HTTPException(400, f"Unknown preset: {preset_name}")
|
||||
|
||||
|
||||
theme = db.query(StoreTheme).filter(
|
||||
StoreTheme.store_id == store_id
|
||||
).first()
|
||||
|
||||
|
||||
if not theme:
|
||||
theme = StoreTheme(store_id=store_id)
|
||||
db.add(theme)
|
||||
|
||||
|
||||
apply_preset(theme, preset_name)
|
||||
db.commit()
|
||||
db.refresh(theme)
|
||||
|
||||
|
||||
return {
|
||||
"message": f"Applied {preset_name} preset",
|
||||
"theme": theme.to_dict()
|
||||
@@ -636,7 +636,7 @@ Create a marketplace of premium themes:
|
||||
```python
|
||||
class PremiumTheme(Base):
|
||||
__tablename__ = "premium_themes"
|
||||
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String(100))
|
||||
description = Column(Text)
|
||||
@@ -650,7 +650,7 @@ Respect user's system preferences:
|
||||
|
||||
```javascript
|
||||
// Detect system dark mode preference
|
||||
if (window.matchMedia &&
|
||||
if (window.matchMedia &&
|
||||
window.matchMedia('(prefers-color-scheme: dark)').matches) {
|
||||
this.dark = true;
|
||||
}
|
||||
@@ -662,7 +662,7 @@ Track which themes perform best:
|
||||
```python
|
||||
class ThemeAnalytics(Base):
|
||||
__tablename__ = "theme_analytics"
|
||||
|
||||
|
||||
theme_id = Column(Integer, ForeignKey("store_themes.id"))
|
||||
conversion_rate = Column(Numeric(5, 2))
|
||||
avg_session_duration = Column(Integer)
|
||||
|
||||
Reference in New Issue
Block a user