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,46 @@
<tr class="table-body-row">
<td class="table-body-cell">
<div class="flex items-center gap-4">
<% logo_path = "stock_logos/#{stock.ticker}-logo.svg" %>
<% if File.exist?("app/assets/images/#{logo_path}") %>
<%= image_tag asset_path(logo_path),
class: "w-16 h-16 rounded-lg flex-shrink-0",
alt: "#{stock.ticker} logo",
loading: "lazy" %>
<% end %>
<div class="flex flex-col">
<%= link_to stock.ticker, stock_path(stock), class: "font-semibold text-lg" %>
<span class="text-gray-500 text-sm"><%= stock.company_name %></span>
</div>
</div>
</td>
<td class="table-body-cell table-body-cell-right">
<span class="table-cell-content">
<%= number_to_currency(stock.current_price) %>
</span>
</td>
<% if policy(stock).show_holdings? %>
<td class="table-body-cell">
<span class="table-cell-content">
<%= @portfolio&.shares_owned(stock.id) || 0 %>
</span>
</td>
<td class="table-body-cell table-body-cell-center whitespace-nowrap" colspan="2">
<% if policy(stock).show_trading_link? %>
<div class="flex gap-2 justify-center">
<%= link_to new_order_path(stock_id: stock.id, transaction_type: :buy),
class: "tw-btn-buy -ml-1",
data: { turbo_frame: "modal_frame", testid: "buy-stock-button" } do %>
<%= lucide_icon("arrow-up") %> Buy
<% end if !stock.archived? %>
<%= link_to new_order_path(stock_id: stock.id, transaction_type: :sell),
class: "tw-btn-sell -mr-1",
data: { turbo_frame: "modal_frame", testid: "sell-stock-button" } do %>
<%= lucide_icon("arrow-down") %> Sell
<% end %>
</div>
<% end %>
</td>
<% end %>
</tr>

View File

@@ -0,0 +1,160 @@
<div id="<%= dom_id stock %>" class="space-y-6">
<% if action_name == "show" %>
<!-- Price and Key Metrics Card -->
<div class="bg-white rounded-[22px] border border-black/30 overflow-hidden">
<div class="bg-amber-300/95 px-6 py-4">
<h2 class="text-lg font-semibold text-gray-900">Current Price & Key Metrics</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-4">
<div class="bg-gray-50 rounded-xl p-4">
<div class="text-sm text-gray-600 mb-1">Current Price</div>
<div class="text-2xl font-bold text-green-600"><%= number_to_currency(stock.current_price) %></div>
</div>
<div class="bg-gray-50 rounded-xl p-4">
<div class="text-sm text-gray-600 mb-1">Stock Exchange</div>
<div class="text-lg font-semibold"><%= stock.stock_exchange %></div>
</div>
<div class="bg-gray-50 rounded-xl p-4">
<div class="text-sm text-gray-600 mb-1">Industry</div>
<div class="text-lg font-semibold"><%= stock.industry %></div>
</div>
<div class="bg-gray-50 rounded-xl p-4">
<div class="text-sm text-gray-600 mb-1">Employees</div>
<div class="text-lg font-semibold"><%= number_with_delimiter(stock.employees) if stock.employees.present? %></div>
</div>
</div>
</div>
</div>
<!-- Company Information Card -->
<div class="bg-white rounded-[22px] border border-black/30 overflow-hidden">
<div class="bg-blue-300/95 px-6 py-4">
<h2 class="text-lg font-semibold text-gray-900">Company Information</h2>
</div>
<div class="p-6">
<div class="space-y-4">
<% if stock.company_website.present? %>
<div>
<label class="text-sm font-medium text-gray-600">Website</label>
<p class="mt-1">
<%= link_to(
stock.company_website,
safe_url(stock.company_website),
target: "_blank",
class: "text-black underline hover:text-[var(--sitf-secondary-chart2)]", rel: "noopener"
) %>
</p>
</div>
<% end %>
<% if stock.description.present? %>
<div>
<label class="text-sm font-medium text-gray-600">Description</label>
<p class="mt-1 text-gray-900 leading-relaxed"><%= stock.description %></p>
</div>
<% end %>
<% if stock.management.present? %>
<div>
<label class="text-sm font-medium text-gray-600">Management</label>
<p class="mt-1 text-gray-900"><%= stock.management %></p>
</div>
<% end %>
<% if stock.competitor_names.present? %>
<div>
<label class="text-sm font-medium text-gray-600">Key Competitors</label>
<p class="mt-1 text-gray-900"><%= stock.competitor_names %></p>
</div>
<% end %>
</div>
</div>
</div>
<!-- Financial Metrics Card -->
<div class="bg-white rounded-[22px] border border-black/30 overflow-hidden">
<div class="bg-green-300/95 px-6 py-4">
<h2 class="text-lg font-semibold text-gray-900">Financial Metrics</h2>
</div>
<div class="p-6">
<div class="grid grid-cols-1 md:grid-cols-2 gap-6">
<!-- Company Metrics -->
<div class="space-y-4">
<h3 class="font-medium text-gray-800 border-b border-gray-200 pb-2">Company Performance</h3>
<% if stock.sales_growth.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Sales Growth</span>
<span class="font-semibold text-gray-900"><%= stock.sales_growth %>%</span>
</div>
<% end %>
<% if stock.profit_margin.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Profit Margin</span>
<span class="font-semibold text-gray-900"><%= stock.profit_margin %>%</span>
</div>
<% end %>
<% if stock.debt_to_equity.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Debt to Equity</span>
<span class="font-semibold text-gray-900"><%= stock.debt_to_equity %></span>
</div>
<% end %>
<% if stock.cash_flow.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Cash Flow</span>
<span class="font-semibold text-gray-900"><%= number_to_currency(stock.cash_flow) %></span>
</div>
<% end %>
<% if stock.debt.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Total Debt</span>
<span class="font-semibold text-gray-900"><%= number_to_currency(stock.debt) %></span>
</div>
<% end %>
</div>
<!-- Industry Averages -->
<div class="space-y-4">
<h3 class="font-medium text-gray-800 border-b border-gray-200 pb-2">Industry Averages</h3>
<% if stock.industry_avg_sales_growth.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Avg Sales Growth</span>
<span class="font-semibold text-gray-900"><%= stock.industry_avg_sales_growth %>%</span>
</div>
<% end %>
<% if stock.industry_avg_profit_margin.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Avg Profit Margin</span>
<span class="font-semibold text-gray-900"><%= stock.industry_avg_profit_margin %>%</span>
</div>
<% end %>
<% if stock.industry_avg_debt_to_equity.present? %>
<div class="flex justify-between items-center py-2">
<span class="text-gray-600">Avg Debt to Equity</span>
<span class="font-semibold text-gray-900"><%= stock.industry_avg_debt_to_equity %></span>
</div>
<% end %>
</div>
</div>
</div>
</div>
<% else %>
<!-- Simplified view for index pages -->
<div class="bg-white rounded-lg border border-gray-200 p-4">
<div class="flex justify-between items-start">
<div>
<h3 class="font-semibold text-lg text-gray-900">
<%= stock.ticker %>
<% if stock.archived? %>
<span class="ml-2 bg-red-100 text-red-800 text-xs font-medium px-2 py-1 rounded-full">ARCHIVED</span>
<% end %>
</h3>
<p class="text-gray-600 mt-1"><%= stock.company_name %></p>
<p class="text-sm text-gray-500 mt-1"><%= stock.stock_exchange %> • <%= stock.industry %></p>
</div>
<div class="text-right">
<div class="text-lg font-bold text-green-600"><%= number_to_currency(stock.current_price) %></div>
<%= link_to "View Details", stock, class: "tw-btn-secondary mt-2" %>
</div>
</div>
</div>
<% end %>
</div>

View File

@@ -0,0 +1,26 @@
<h2 class="text-2xl font-semibold mb-4"><%= title %></h2>
<%= render "shared/table_container" do %>
<thead>
<tr class="table-header-row">
<th class="table-header-cell table-header-cell-left">Company (Exchange)</th>
<th class="table-header-cell table-header-cell-right">Last Price</th>
<% if current_user.student? %>
<th class="table-header-cell table-header-cell-left">Your Holdings</th>
<th class="table-header-cell table-header-cell-center" colspan="2"></th>
<% end %>
</tr>
</thead>
<tbody>
<% if stocks.any? %>
<% stocks.each do |stock| %>
<%= render "stocks/index_row", stock: stock %>
<% end %>
<% else %>
<tr class="table-body-row">
<td class="table-empty-cell" colspan="<%= current_user.student? ? 5 : 2 %>">
<p class="text-lg">No <%= title.downcase %> found</p>
</td>
</tr>
<% end %>
</tbody>
<% end %>

View File

@@ -0,0 +1,35 @@
<div class="w-full px-6">
<% if notice.present? %>
<p class="py-2 px-3 bg-green-50 mb-5 text-green-500 font-medium rounded-lg inline-block" id="notice"><%= notice %></p>
<% end %>
<% if current_user.student? && !current_user.classroom&.trading_enabled? %>
<div class="bg-yellow-50 border-l-4 border-yellow-400 p-4 rounded-lg mb-5">
<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="flex flex-col lg:flex-row justify-between items-start lg:items-center pb-2 pt-4 gap-4">
<h1 class="font-bold text-4xl">Trading Floor</h1>
<% if policy(Stock).show_holdings? || (current_user.present? && current_user.student?) %>
<div class="mt-4">
<%= render 'shared/earnings_to_invest_card' %>
</div>
<% end %>
</div>
<main class="flex-1 py-6">
<%= render "stocks/stocks_table", title: "Active Stocks", stocks: @stocks.active %>
<%= render "stocks/stocks_table", title: "Archived Stocks", stocks: @stocks.archived %>
</main>
</div>

View File

@@ -0,0 +1,37 @@
<div class="min-h-full">
<div class="max-w-[1180px] mx-auto px-4 py-6 space-y-6" style="font-family: Inter, system-ui, sans-serif;">
<% if notice.present? %>
<div class="bg-green-50 border border-green-200 text-green-800 px-4 py-3 rounded-lg mb-6">
<p class="font-medium"><%= notice %></p>
</div>
<% end %>
<!-- Header with stock symbol and company name -->
<div class="flex flex-col lg:flex-row lg:items-center lg:justify-between gap-4">
<div class="flex items-center gap-3 min-w-0 flex-1">
<div class="flex items-center gap-1 text-2xl flex-shrink-0"><span>📈📊</span></div>
<div class="min-w-0 flex-1">
<h1 class="text-xl lg:text-2xl font-bold tracking-wide truncate">
<%= @stock.ticker %>
<span class="font-normal text-gray-600 text-base lg:text-lg">| <%= @stock.company_name %></span>
</h1>
<% if @stock.archived? %>
<span class="bg-red-100 text-red-800 text-sm font-medium px-3 py-1 rounded-full mt-2 inline-block">ARCHIVED</span>
<% end %>
</div>
</div>
<div class="flex gap-3 flex-shrink-0">
<%= link_to "Back to stocks", stocks_path, class: "tw-btn-tertiary" %>
<% if policy(@stock).show_trading_link? %>
<%= link_to "Trade Stock", stocks_path, class: "inline-flex items-center justify-center rounded-full bg-sky-800 text-white px-6 py-2 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" %>
<% end %>
</div>
</div>
<%= render @stock %>
<!-- Bottom spacing to ensure content doesn't get cut off -->
<div class="h-8"></div>
</div>
</div>
</div>