chore: init commit

in worker.../repo/GITFOLDER.zip is the .git folder.
This commit is contained in:
2026-08-11 14:44:09 -04:00
parent 0012380fd3
commit 2854619bc9
782 changed files with 65944 additions and 0 deletions

View File

@@ -0,0 +1,127 @@
<%# Redesigned Portfolio Page %>
<div class="max-w-[1180px] mx-auto px-4 sm:px-6 py-6 space-y-6" style="font-family: Inter, system-ui, sans-serif;">
<!-- Header with badge icons and title -->
<div class="flex items-center gap-2 sm:gap-3">
<div class="flex items-center gap-1 text-xl sm:text-2xl"><span>📙💰</span></div>
<h1 class="text-sm sm:text-base md:text-lg lg:text-xl font-medium tracking-wide">
<%= @portfolio.username.upcase %>, PORTFOLIO
<span class="font-normal text-gray-500 block sm:inline">
<span class="hidden sm:inline">| </span><%= @portfolio.school_name %>
</span>
</h1>
</div>
<% if @portfolio.student? && !@portfolio.trading_enabled? %>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-lg">
<div class="flex items-start">
<div class="flex-shrink-0">
<svg class="h-5 w-5 text-yellow-400" viewBox="0 0 20 20" fill="currentColor">
<path fill-rule="evenodd" d="M8.257 3.099c.765-1.36 2.722-1.36 3.486 0l5.58 9.92c.75 1.334-.213 2.98-1.742 2.98H4.42c-1.53 0-2.493-1.646-1.743-2.98l5.58-9.92zM11 13a1 1 0 11-2 0 1 1 0 012 0zm-1-8a1 1 0 00-1 1v3a1 1 0 002 0V6a1 1 0 00-1-1z" clip-rule="evenodd" />
</svg>
</div>
<div class="ml-3">
<p class="text-sm font-medium text-yellow-800">Trading is currently disabled for your classroom.</p>
<p class="mt-1 text-sm text-yellow-700">You cannot place buy or sell orders at this time. Please contact your teacher for more information.</p>
</div>
</div>
</div>
<% end %>
<div class="grid grid-cols-1 lg:grid-cols-3 gap-8">
<!-- Left area (spans 2 columns on large screens): metrics + holdings table -->
<div class="flex flex-col gap-6 lg:col-span-2">
<%= render 'portfolios/portfolio_chart' %>
<div class="grid grid-cols-1 sm:grid-cols-2 xl:grid-cols-3 gap-4">
<%# Total Earnings Card %>
<div class="bg-white rounded-[22px] border border-black/30 py-4 px-5 flex flex-col justify-between min-h-[120px]">
<div class="text-sm text-gray-600">Total Earnings</div>
<div class="text-2xl font-semibold"><%= number_to_currency(@portfolio.cash_balance) %></div>
<div><%# Trending up/down this month will go here %></div>
</div>
<%# Total Cash Value %>
<div class="bg-white rounded-[22px] border border-black/30 py-4 px-5 flex flex-col justify-between min-h-[120px]" data-testid="cash-balance">
<div class="text-sm text-gray-600">Total Cash Value</div>
<div class="text-2xl font-semibold"><%= number_to_currency(@portfolio.cash_balance) %></div>
<div><%# Trending up/down this month will go here %></div>
</div>
<%# Total Stocks %>
<div class="bg-white rounded-[22px] border border-black/30 py-4 px-5 flex flex-col justify-between min-h-[120px]" data-testid="total-stocks">
<div class="text-sm text-gray-600">Total Stocks</div>
<div class="text-2xl font-semibold"><%= @portfolio.portfolio_stocks.sum(:shares).to_i %></div>
<div><%# Trending up/down this month will go here %></div>
</div>
</div>
<!-- Holdings Table -->
<div class="rounded-xl border border-black/60 bg-white overflow-hidden" data-testid="holdings-table">
<div class="overflow-x-auto">
<table class="w-full min-w-[700px] border-collapse">
<colgroup class="hidden lg:table-column-group">
<col class="w-[34%]">
<col class="w-[8%]">
<col class="w-[18%]">
<col class="w-[18%]">
<col class="w-[18%]">
<col class="w-[14%]">
</colgroup>
<thead>
<tr class="bg-amber-300/95 text-xs sm:text-[13px]">
<th scope="col" class="text-left py-3 pl-6 pr-4 font-medium">Current Holdings</th>
<th scope="col" class="text-left py-3 px-4 font-medium">Qty.</th>
<th scope="col" class="text-left py-3 px-4 font-medium">Last Price</th>
<th scope="col" class="text-left py-3 px-4 font-medium">Change</th>
<th scope="col" class="text-left py-3 px-4 font-medium">Total Return</th>
<th class="py-3 pr-6"></th>
</tr>
</thead>
<tbody class="text-xs sm:text-[14px]">
<% @portfolio.positions.each do |position| %>
<% price = position.stock_current_price %>
<% shares = position.shares %>
<% change_amount = position.change_amount %>
<% total_return_amount = position.total_return_amount %>
<% logo_path = "stock_logos/#{position.stock_ticker}-logo.svg" %>
<tr class="border-t first:border-t-0 border-black/40">
<td class="py-4 pl-6 pr-4 align-middle">
<div class="flex items-center gap-4">
<% if File.exist?("app/assets/images/#{logo_path}") %>
<%= image_tag asset_path(logo_path),
class: "w-10 h-10 rounded-lg flex-shrink-0",
alt: "#{position.stock_ticker} logo",
loading: "lazy" %>
<% end %>
<div class="flex flex-col">
<span class="font-medium"><%= position.stock_ticker %></span>
</div>
</div>
</td>
<td class="py-4 px-4 align-middle"><%= shares %></td>
<td class="py-4 px-4 align-middle tabular-nums"><%= number_to_currency(price) %></td>
<td class="py-4 px-4 align-middle tabular-nums <%= change_amount >= 0 ? 'text-green-600' : 'text-red-600' %>">
<% if change_amount >= 0 %>+<% end %> <%= number_to_currency(change_amount) %>
</td>
<td class="py-4 px-4 align-middle tabular-nums <%= total_return_amount >= 0 ? 'text-green-600' : 'text-red-600' %>">
<% if total_return_amount >= 0 %>+<% end %> <%= number_to_currency(total_return_amount) %>
</td>
<td class="py-3 pr-6 align-middle">
<% if current_user.student? %>
<%= link_to "Trade", stocks_path, class: "inline-flex items-center justify-center rounded-full bg-sky-800 text-white px-6 py-2 text-xs sm:text-sm font-medium shadow hover:bg-sky-700 focus:outline-none focus:ring-2 focus:ring-sky-500 focus:ring-offset-1 transition-colors" %>
<% else %>
<span class="inline-flex items-center justify-center rounded-full px-6 py-2 text-xs sm:text-sm font-medium shadow cursor-not-allowed bg-[var(--sitf-8)] text-[var(--sitf-7)]">Trade</span>
<% end %>
</td>
</tr>
<% end %>
</tbody>
</table>
</div>
</div>
</div>
<!-- Right column (single column on large screens): My Earnings to Invest + Summary -->
<div class="flex flex-col gap-6 lg:col-span-1">
<%= render 'shared/earnings_to_invest_card' %>
<%= render 'portfolios/earnings_summary_card' %>
</div>
</div>
</div>