HomePage.vala 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. using Astralis;
  2. using Invercargill;
  3. using Invercargill.DataStructures;
  4. using Inversion;
  5. using Spry;
  6. /**
  7. * HomePage - The main landing page
  8. *
  9. * Eye-catching hero section with gradient text,
  10. * feature highlights, and call-to-action buttons
  11. */
  12. public class HomePage : PageComponent {
  13. public const string ROUTE = "/";
  14. private ComponentFactory factory = inject<ComponentFactory>();
  15. public override string markup { get {
  16. return """
  17. <div sid="home">
  18. <!-- Hero Section -->
  19. <section class="hero">
  20. <div class="container">
  21. <span class="hero-badge">
  22. ⚡ Free & Open Source
  23. </span>
  24. <h1>Build Modern Web Apps in Vala</h1>
  25. <p class="hero-subtitle">
  26. Spry is a component-based web framework featuring HTMX integration,
  27. reactive templates, and dependency injection. Fast, type-safe, and elegant.
  28. </p>
  29. <div class="hero-actions">
  30. <a href="/demo" class="btn btn-primary">
  31. ✨ Try Live Demo
  32. </a>
  33. <a href="/features" class="btn btn-secondary">
  34. Explore Features
  35. </a>
  36. </div>
  37. </div>
  38. </section>
  39. <!-- Quick Stats -->
  40. <section class="section">
  41. <div class="container">
  42. <div class="stats-grid">
  43. <div class="stat-card">
  44. <div class="stat-value">100%</div>
  45. <div class="stat-label">Type-Safe Vala</div>
  46. </div>
  47. <div class="stat-card">
  48. <div class="stat-value">0</div>
  49. <div class="stat-label">JavaScript Required</div>
  50. </div>
  51. <div class="stat-card">
  52. <div class="stat-value">∞</div>
  53. <div class="stat-label">Possibilities</div>
  54. </div>
  55. <div class="stat-card">
  56. <div class="stat-value">FREE</div>
  57. <div class="stat-label">Forever</div>
  58. </div>
  59. </div>
  60. </div>
  61. </section>
  62. <!-- Feature Highlights -->
  63. <section class="section">
  64. <div class="container">
  65. <div class="section-header">
  66. <h2>Why Choose Spry?</h2>
  67. <p>Build powerful web applications with a framework designed for developer happiness</p>
  68. </div>
  69. <div class="features-grid">
  70. <spry-outlet sid="features"/>
  71. </div>
  72. </div>
  73. </section>
  74. <!-- Code Example -->
  75. <section class="section">
  76. <div class="container">
  77. <div class="section-header">
  78. <h2>Clean, Intuitive Code</h2>
  79. <p>Write components that are easy to understand and maintain</p>
  80. </div>
  81. <div class="code-block">
  82. <div class="code-header">
  83. <div class="code-dots">
  84. <div class="code-dot red"></div>
  85. <div class="code-dot yellow"></div>
  86. <div class="code-dot green"></div>
  87. </div>
  88. <span class="code-lang">Vala</span>
  89. </div>
  90. <pre><code>class CounterComponent : Component {
  91. private int count = 0;
  92. public override string markup {
  93. owned get {
  94. // Use spry-action for interactivity
  95. return @"Counter: $(count)
  96. [Button: spry-action=':Increment' +]
  97. [Button: spry-action=':Decrement' -]";
  98. }
  99. }
  100. public async override void handle_action(string action) {
  101. if (action == "Increment") count++;
  102. else if (action == "Decrement") count--;
  103. }
  104. }</code></pre>
  105. </div>
  106. </div>
  107. </section>
  108. <!-- CTA Section -->
  109. <section class="section">
  110. <div class="container">
  111. <div class="freedom-section">
  112. <div class="freedom-icon">🕊</div>
  113. <h2>Free as in Freedom</h2>
  114. <p>
  115. Spry is Free/Libre Open Source Software. Use it, study it, modify it,
  116. and share it freely. Built by the community, for the community.
  117. </p>
  118. <div class="hero-actions">
  119. <a href="/freedom" class="btn btn-accent">
  120. Learn About Freedom
  121. </a>
  122. <a href="/ecosystem" class="btn btn-secondary">
  123. Explore Ecosystem
  124. </a>
  125. </div>
  126. </div>
  127. </div>
  128. </section>
  129. </div>
  130. """;
  131. }}
  132. public override async void prepare() throws Error {
  133. var features = new Series<Renderable>();
  134. var feature1 = factory.create<FeatureCardComponent>();
  135. feature1.icon = "purple";
  136. feature1.icon_emoji = "⚡";
  137. feature1.title = "HTMX Integration";
  138. feature1.description = "Build dynamic UIs without writing JavaScript. HTMX handles the complexity, you handle the logic.";
  139. features.add(feature1);
  140. var feature2 = factory.create<FeatureCardComponent>();
  141. feature2.icon = "blue";
  142. feature2.icon_emoji = "🔧";
  143. feature2.title = "Dependency Injection";
  144. feature2.description = "Clean architecture with Inversion of Control. Inject services, stores, and components effortlessly.";
  145. features.add(feature2);
  146. var feature3 = factory.create<FeatureCardComponent>();
  147. feature3.icon = "green";
  148. feature3.icon_emoji = "🎨";
  149. feature3.title = "Reactive Templates";
  150. feature3.description = "Declarative templates with outlets and automatic updates. Your UI stays in sync with your data.";
  151. features.add(feature3);
  152. var feature4 = factory.create<FeatureCardComponent>();
  153. feature4.icon = "purple";
  154. feature4.icon_emoji = "🔒";
  155. feature4.title = "Type-Safe";
  156. feature4.description = "Full Vala type safety means fewer runtime errors. The compiler catches bugs before you do.";
  157. features.add(feature4);
  158. var feature5 = factory.create<FeatureCardComponent>();
  159. feature5.icon = "blue";
  160. feature5.icon_emoji = "🚀";
  161. feature5.title = "High Performance";
  162. feature5.description = "Built on Astralis for maximum throughput. Native code performance with web framework convenience.";
  163. features.add(feature5);
  164. var feature6 = factory.create<FeatureCardComponent>();
  165. feature6.icon = "green";
  166. feature6.icon_emoji = "📦";
  167. feature6.title = "Modular Design";
  168. feature6.description = "Use what you need, extend what you want. Clean separation of concerns at every level.";
  169. features.add(feature6);
  170. set_outlet_children("features", features);
  171. }
  172. }