Skip to content

Add OpenAPI-aligned fields and mobile-first responsive design (300px-4K+)#15

Merged
tayyebi merged 7 commits intomainfrom
copilot/update-ui-templates-responsive-design-again
Jan 22, 2026
Merged

Add OpenAPI-aligned fields and mobile-first responsive design (300px-4K+)#15
tayyebi merged 7 commits intomainfrom
copilot/update-ui-templates-responsive-design-again

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Jan 22, 2026

Updates data structures to match new OpenAPI schema and implements comprehensive responsive design supporting 300px to 5K+ displays.

API Layer Changes

Structs updated with new optional fields:

  • Region: abbr, image, is_active, is_out_of_stock, overall_activeness, ddos_activeness, is_premium, is_hidden, has_offset_price, max_discount_percent, position, config
  • InstanceView: Raw fields (vcpu_count, ram, disk, product_id, network_status, class, is_ddos_protected, inserted_at) + ExtraResource struct (cpu, ram_in_gb, disk_in_gb)
  • Application: price, pricing_type, is_active, tag, is_experimental, os_family, os_list
  • OsItem: is_active

All API parsing logic updated to extract new fields. Legacy Region fields (slug, country, city, latitude, longitude) retained as optional for backward compatibility.

Responsive CSS Architecture

Replaced monolithic responsive.css with 6 dedicated files:

mobile.css       (≤767px)   → Fixed nav, card tables, 48px touch targets
tablet.css       (≥768px)   → 260px sidebar, normal tables
desktop.css      (≥1024px)  → Grid layout
large-desktop.css(≥1536px)  → 300px sidebar, increased spacing
4k.css           (≥2560px)  → 360px sidebar, 64px icons
ultra-wide.css   (≥3840px)  → 400px sidebar, 3200px container

Enhanced base styles:

  • Fluid typography with clamp() scaling (300px-5K+)
  • Responsive grid system with auto-fit
  • Container system with breakpoint-specific max-widths
  • Touch-friendly sizing (44px minimum)
  • Badge components (premium, warning, success, security)

Template Updates

  • Region selection: Displays abbreviation, premium/out-of-stock indicators
  • OS/App selection: Shows pricing, experimental status, OS family; filters by is_active
  • Instance list: Exposes class, DDoS protection, raw specs; uses data-label attributes for mobile card layout
  • Product selection: Responsive grid with grid-auto-fit

All templates wrapped in .container for consistent max-width behavior across breakpoints.

Mobile Table Pattern

<td data-label="Specs">
  {{ instance.vcpu_count }} vCPU · {{ instance.ram }} MB · {{ instance.disk }} GB
</td>

Mobile CSS transforms tables to cards using data-label for field names, maintaining accessibility while optimizing for small screens.

Original prompt

Update UI Templates + Implement Rich Mobile-First Responsive Design

Objective

  1. Update ALL HTML templates to work with the new OpenAPI-aligned structs (Region, Product, Instance, Application, etc.)
  2. Implement a comprehensive mobile-first responsive design system
  3. Support screens from 300px (small mobile) to 4K+ TVs and beyond
  4. Maintain current code structure (Askama templates + CSS)

Part 1: Template Updates for New Schema

1.1 Region Template Updates

Old Region struct fields (REMOVED):

  • slug, country, city, latitude, longitude

New Region struct fields (ADD):

  • abbr, image, is_active, is_out_of_stock, overall_activeness, ddos_activeness, is_premium, is_hidden, has_offset_price, max_discount_percent, position, config

Files to update:

  • templates/step_1.html - Region selection wizard
  • Any templates displaying region information

Changes needed:

<!-- OLD -->
<span>{{ region.city }}, {{ region.country }}</span>

<!-- NEW -->
<span>{{ region.abbr }}</span>
{% if region.is_premium %}<span class="badge badge-premium">Premium</span>{% endif %}
{% if region.is_out_of_stock %}<span class="badge badge-warning">Out of Stock</span>{% endif %}
{% if region.image %}
  <img src="{{ region.image }}" alt="{{ region.name }}" class="region-icon">
{% endif %}

1.2 Product Template Updates

Old Product struct (REMOVED):

  • display_name, description, tags, spec_entries, price_entries, cpu, ram, storage, bandwidth (as strings)

New Product struct (ADD):

  • plan (nested object with specification: cpu, ram, storage, bandwidth_in_tb)
  • price_items (array with monthly_price, hourly_price, etc.)
  • region_id, plan_id, network_max_rate, discount_percent, overall_activeness, ddos_activeness

Files to update:

  • templates/step_3_fixed.html - Product selection
  • templates/step_7.html - Review page
  • templates/resize.html - Resize options

Changes needed:

<!-- OLD -->
<div class="product-card">
  <h3>{{ product.name }}</h3>
  <p>{{ product.description }}</p>
  {% for spec in product.spec_entries %}
    <div>{{ spec.term }}: {{ spec.value }}</div>
  {% endfor %}
  {% for price in product.price_entries %}
    <div>{{ price.term }}: {{ price.value }}</div>
  {% endfor %}
</div>

<!-- NEW -->
<div class="product-card">
  <h3>{{ product.plan.id }}</h3>
  <div class="product-specs">
    <span>{{ product.plan.specification.cpu }} vCPU</span>
    <span>{{ product.plan.specification.ram }} GB RAM</span>
    <span>{{ product.plan.specification.storage }} GB Storage</span>
    <span>{{ product.plan.specification.bandwidth_in_tb }} TB Bandwidth</span>
  </div>
  <div class="product-pricing">
    {% for price_item in product.price_items %}
      <div>
        <span>Monthly: ${{ price_item.monthly_price }}</span>
        <span>Hourly: ${{ price_item.hourly_price }}</span>
        {% if price_item.discount_percent > 0 %}
          <span class="badge badge-success">{{ price_item.discount_percent }}% OFF</span>
        {% endif %}
      </div>
    {% endfor %}
  </div>
  {% if not product.overall_activeness %}
    <span class="badge badge-warning">Unavailable</span>
  {% endif %}
</div>

1.3 Instance Template Updates

Old Instance struct:

  • Display fields: status_display, vcpu_count_display, ram_display, disk_display

New Instance struct (ADD):

  • Raw data: vcpu_count, ram, disk, inserted_at, product_id, network_status, extra_resource, class, is_ddos_protected, etc.
  • Display fields moved to #[serde(skip)]

Files to update:

  • templates/instances.html - Instance list
  • templates/instance_detail.html - Instance details
  • templates/change_os_instance.html
  • templates/change_pass_instance.html
  • templates/resize.html

Changes needed:

<!-- Use raw data fields -->
<dl>
  <div>
    <dt>vCPU</dt>
    <dd>{{ instance.vcpu_count }}</dd>
  </div>
  <div>
    <dt>RAM</dt>
    <dd>{{ instance.ram }} MB</dd>
  </div>
  <div>
    <dt>Disk</dt>
    <dd>{{ instance.disk }} GB</dd>
  </div>
  <div>
    <dt>Class</dt>
    <dd>{{ instance.class }}</dd>
  </div>
  {% if instance.is_ddos_protected %}
    <div><span class="badge badge-security">DDoS Protected</span></div>
  {% endif %}
  {% if instance.extra_resource %}
    <div>
      <dt>Extra Resources</dt>
      <dd>
        {% if instance.extra_resource.cpu %}+{{ instance.extra_resource.cpu }} CPU{% endif %}
        {% if instance.extra_resource.ram_in_gb %}+{{ instance.extra_resource.ram_in_gb }} GB RAM{% endif %}
        {% if instance.extra_resource.disk_in_gb %}+{{ instance.extra_resource.disk_in_gb }} GB Disk{% endif %}
      </dd>
    </div>
  {% endif %}
</dl>

1.4 Application Template Updates

New Application fields:

  • price, pricing_type, is_active, tag, is_experimental, os_family, os_list

Files to update:

  • templates/step_4.html - Application ...

This pull request was created from Copilot chat.


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits January 22, 2026 12:51
… 5K+

Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
…ance, Application, and OS

Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
…grids

Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
…(mobile, tablet, desktop, large-desktop, 4k, ultra-wide)

Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
…re, improve region indicators

Co-authored-by: tayyebi <14053493+tayyebi@users.noreply.github.com>
Copilot AI changed the title [WIP] Update UI templates and implement mobile-first design Add OpenAPI-aligned fields and mobile-first responsive design (300px-4K+) Jan 22, 2026
Copilot AI requested a review from tayyebi January 22, 2026 13:09
@tayyebi tayyebi marked this pull request as ready for review January 22, 2026 14:20
@tayyebi tayyebi merged commit 3860300 into main Jan 22, 2026
@tayyebi tayyebi deleted the copilot/update-ui-templates-responsive-design-again branch January 24, 2026 11:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants