• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
devto

devto

adportal

Unlisted
Like
adportal
Home
Code
20
api
7
controllers
3
models
2
public
7
services
5
tests
1
utils
3
views
4
README.md
REFACTORING-PHASE1.md
REFACTORING-PHASE2.md
REFACTORING-PHASE3.md
REFACTORING-PHASE4.md
REFACTORING-PHASE5.md
REFACTORING.md
TEMPLATE-FIX.md
devto-stylesheet-README.md
C
devto-stylesheet-fetcher.ts
H
devto-stylesheet-provider.ts
H
index.ts
Branches
2
Pull requests
Remixes
History
Environment variables
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
REFACTORING-PHASE3.md
Code
/
REFACTORING-PHASE3.md
Search
5/8/2025
Viewing readonly version of main branch: v445
View latest version
REFACTORING-PHASE3.md

DEV Partner Portal Refactoring - Phase 3

This document outlines the changes made in Phase 3 of the continue.html refactoring.

Phase 3: Landing Page Components and Form Validation

Building on the foundation established in Phases 1 and 2, we've extended the component system to the landing page and implemented client-side validation.

Landing Page Components

  1. Submission Form Component (/views/components/forms/submission-form.html)

    • Main form for collecting company name and email
    • Uses the form-field component for consistent styling
    • Example usage:
      {{> components/forms/submission-form}}
  2. Magic Link Form Component (/views/components/forms/magic-link-form.html)

    • Form for requesting a magic link for existing users
    • Uses the form-field component for consistent styling
    • Includes success and error message boxes
    • Example usage:
      {{> components/forms/magic-link-form}}
  3. Success Message Component (/views/components/ui/success-message.html)

    • Enhanced success message with icon and details
    • Example usage:
      {{> components/ui/success-message id="successMessage" title="Submission Successful!" message="Thank you for your submission!" details="Please check your inbox for important information." }}

Landing Page Template

We've created a new template (landing-template.html) that uses these components:

<!DOCTYPE html> <html lang="en"> <head> {{> components/meta-tags}} <title>DEV Partner Portal</title> <link rel="stylesheet" href="/public/css/styles.css"> <link rel="stylesheet" href="/public/css/continue-page.css"> </head> <body class="min-h-screen flex flex-col"> <main class="flex-1 flex flex-col items-center justify-center p-6"> <div class="w-full max-w-md bg-white p-8 rounded-lg shadow-md"> <h1 class="text-3xl font-bold text-center mb-8">DEV Partner Portal</h1> <!-- Main Form --> {{> components/forms/submission-form}} <!-- Magic Link Request Form --> {{> components/forms/magic-link-form}} <!-- Success Message with Enhanced Design --> {{> components/ui/success-message id="successMessage" title="Submission Successful!" message="Thank you for your submission! We've sent a confirmation email with next steps." details="Please check your inbox for important information about your submission." }} <!-- Error Message --> {{> components/ui/message-box id="errorMessage" type="error" }} </div> </main> {{> components/layout/footer year="2023"}} <script src="/public/js/landing.js" type="module"></script> </body> </html>

Client-Side Validation

We've implemented a comprehensive client-side validation system:

  1. Form Validator Module (/public/js/modules/form-validator.js)

    • Validates form fields based on type (email, url, text)
    • Shows validation errors inline
    • Supports live validation on blur and input events
    • Prevents form submission if validation fails
  2. Validation Integration

    • Updated landing.js to use the validation module
    • Updated continue.js to use the validation module
    • Added validation before form submission

JavaScript Improvements

  1. Enhanced Landing.js

    • Added form validation
    • Improved error handling
    • Better separation of concerns
  2. Enhanced Continue.js

    • Added form validation
    • Improved error handling
    • Better separation of concerns

Benefits of Phase 3

  1. Consistent User Experience: Both landing and continue pages use the same component system
  2. Improved Form Validation: Client-side validation provides immediate feedback to users
  3. Better Error Handling: Validation errors are shown inline with the form fields
  4. Enhanced User Experience: Live validation helps users correct errors as they type
  5. Reduced Server Load: Invalid forms are caught before submission
  6. Maintainable Code: Validation logic is centralized in a single module

Example: Form Validation

// Set up live validation for both forms if (form) { setupLiveValidation(form); } // Handle form submission form.addEventListener('submit', (e) => { e.preventDefault(); // Validate the form before submission if (!validateForm(form)) { return; } // Form submission logic... });

Next Steps

For Phase 4, we would:

  1. Implement more sophisticated interactions between components
  2. Add accessibility improvements (ARIA attributes, keyboard navigation)
  3. Create a component library documentation page
  4. Add unit tests for components and validation
  5. Implement performance optimizations
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2025 Val Town, Inc.