Compare commits

..

No commits in common. "f7cedfd799e18a30547e5c2d1173b37411b787b6" and "2f237acaecde53d344441b680af825164da37014" have entirely different histories.

9 changed files with 72 additions and 166 deletions

View File

@ -14,7 +14,7 @@
/* theme */ /* theme */
--color-base-background: rgb(39, 44, 56); --color-base-background: rgb(39, 44, 56);
--color-base-secondary: rgb(55, 61, 71); --color-base-secondary: rgb(55, 61, 71);
--color-base-text: rgb(255, 255, 255); --color-base-text: rgb(152, 158, 172);
--color-base-border: rgb(77, 84, 102); --color-base-border: rgb(77, 84, 102);
--base-font-size: 0.85rem; --base-font-size: 0.85rem;
@ -78,29 +78,16 @@
} }
.select-style { .select-style {
@apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs text-base-background @apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs
}
.select-style option {
color: theme('colors.base-background');
} }
.input-style { .input-style {
@apply block w-full px-3 py-1.5 border border-default-slate/50 rounded-xs @apply block w-full h-8 px-3 py-1.5 border border-default-slate/50 rounded-xs
} }
.textarea-style { .textarea-style {
@apply block w-full pl-4 flex-1 py-1.5 ring-1 ring-inset ring-default-slate/50 rounded-xs @apply block w-full pl-4 flex-1 py-1.5 ring-1 ring-inset ring-default-slate/50 rounded-xs
} }
/*Toggle Button*/
.toggle_style {
@apply w-14 h-8 bg-danger rounded-full peer-checked:bg-notice transition-all duration-300
}
.toggle_btn {
@apply absolute left-1 top-1 w-6 h-6 bg-white rounded-full transition-all duration-300 peer-checked:translate-x-full shadow-sm
}
} }
@layer utilities { @layer utilities {
@ -196,7 +183,7 @@
} }
.base-table th { .base-table th {
@apply bg-base-background px-2 py-2 text-left font-bold lg:table-cell @apply bg-base-text px-2 py-2 text-left font-bold lg:table-cell
} }
.base-table td { .base-table td {

View File

@ -10,8 +10,5 @@ application.register("hello", HelloController)
import ModalsController from "./modals_controller" import ModalsController from "./modals_controller"
application.register("modals", ModalsController) application.register("modals", ModalsController)
import SidebarController from "./sidebar_controller"
application.register("sidebar", SidebarController)
import TimerController from "./timer_controller" import TimerController from "./timer_controller"
application.register("timer", TimerController) application.register("timer", TimerController)

View File

@ -1,15 +0,0 @@
import { Controller } from "@hotwired/stimulus"
export default class extends Controller {
static targets = ["menu", "overlay"]
toggle() {
this.menuTarget.classList.toggle("-translate-x-full")
this.overlayTarget.classList.toggle("hidden")
}
close() {
this.menuTarget.classList.add("-translate-x-full")
this.overlayTarget.classList.add("hidden")
}
}

View File

@ -25,11 +25,11 @@
<body class="min-h-screen bg-base-background text-base-text min-w-[400px] overflow-x-auto h-full"> <body class="min-h-screen bg-base-background text-base-text min-w-[400px] overflow-x-auto h-full">
<%= turbo_frame_tag :modals %> <%= turbo_frame_tag :modals %>
<main class="flex flex-col h-full" data-controller="sidebar"> <main class="flex flex-col h-full">
<%= render "partials/header" %> <%= render "partials/header" %>
<div class="flex flex-row flex-1 w-full"> <div class="flex flex-row flex-1 w-full">
<%= render "partials/sidebar" %> <%= render "partials/sidebar" %>
<div class="flex-1 h-full pb-4 px-4 md:pl-0"> <div class="flex-1 h-full pb-4 pr-4">
<div class="flex-1 h-full content"> <div class="flex-1 h-full content">
<% if flash[:notice] %> <% if flash[:notice] %>
<div class="rounded px-4 py-2 bg-accept text-white"> <div class="rounded px-4 py-2 bg-accept text-white">

View File

@ -1,14 +1,9 @@
<header class="flex header justify-between items-center"> <header class="flex header" data-controller="timer">
<div class="flex flex-row h-full items-center"> <div class="flex flex-row h-full">
<%= image_tag "svg/svg_logo.svg", class: "w-auto h-8 mr-4" %> <%= image_tag "svg/svg_logo.svg", class: "w-fit h-auto mr-4" %>
<%= link_to root_path do %> <%= link_to root_path do %>
<div class="flex h-full items-center tracking-[0.5rem]">FARMITRY</div> <div class="flex h-full items-center tracking-[0.5rem]">FARMITRY</div>
<% end %> <% end %>
</div> </div>
<div data-timer-target="output"></div>
<div data-timer-target="output" class="hidden md:block"></div>
<button data-action="click->sidebar#toggle" class="block md:hidden p-2 cursor-pointer">
<i class="fa-solid fa-bars text-2xl"></i>
</button>
</header> </header>

View File

@ -1,5 +1,4 @@
<div data-sidebar-target="overlay" data-action="click->sidebar#close" class="fixed inset-0 bg-black/50 z-40 hidden md:hidden"></div> <nav class="side-bar overflow-y-auto">
<nav class="side-bar overflow-y-auto transition-transform md:translate-x-0 -translate-x-full fixed md:relative top-0 left-0 h-full bg-base-background z-50" data-sidebar-target="menu">
<div class="menu-group"> <div class="menu-group">
<div class="menu-group-icon"> <div class="menu-group-icon">
<i class="fa-solid fa-house text-base-text/30 text-4xl"></i> <i class="fa-solid fa-house text-base-text/30 text-4xl"></i>

View File

@ -1,62 +1,45 @@
<div class="flex flex-col h-full text-white overflow-y-auto"> <div class="flex flex-col h-full text-white overflow-y-auto ">
<div class="flex flex-col flex-1 divide-y divide-base-border"> <div class="flex flex-col flex-1 divide-y divide-base-border">
<%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full' do %> <%= form_with url: schedule_edit_update_schedules_path, method: :post, class: 'flex flex-col h-full divide-y divide-border-base-border p-4' do %>
<%= hidden_field_tag :controller_id, params[:id] %> <%= hidden_field_tag :controller_id, params[:id] %>
<div class="divide-y divide-base-border"> <div class="space-y-4">
<div class="flex justify-between p-4"> <div class="flex justify-between">
<div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div> <div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div>
<%= submit_tag "업데이트", class: "btn bg-primary" %> <%= submit_tag "업데이트", class: "btn bg-primary" %>
</div> </div>
<ul class="divide-y divide-base-border whitespace-nowrap"> <table class="base-table">
<thead>
<tr>
<th>시간</th>
<th>분</th>
<th>사용여부</th>
<th>온도</th>
<th>삭제</th>
</tr>
</thead>
<tbody>
<% @schedule.each do |s| %> <% @schedule.each do |s| %>
<li class="flex justify-between items-center px-4 py-2 space-x-4"> <tr>
<div class="flex items-center space-x-4 basis-2/3"> <td>
<!-- 시간 --> <%= select_tag "schedule[#{s.id}][hour]",
<div class="flex flex-col md:flex-row w-full items-center space-x-0 space-y-2 md:space-x-2 md:space-y-0"> options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour),
<div class="text-white">시간</div> class: "input-style" %>
<div class="text-xl flex items-center space-x-1"> </td>
<%= select_tag "schedule[#{s.id}][hour]", <td><%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %></td>
options_for_select((0..23).map { |h| [h.to_s.rjust(2, '0'), h] }, s.hour), <td><%= check_box_tag "schedule[#{s.id}][is_active]", "1", s.is_active == true || s.is_active == 1 %></td>
class: "select-style text-white" %> <td><%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %></td>
<div>:</div> <td>
<%= number_field_tag "schedule[#{s.id}][minute]", s.minute, min: 0, max: 59, step: 1, inputmode: "decimal", class: "input-style" %>
</div>
</div>
<!-- 온도 -->
<div class="flex flex-col md:flex-row w-full items-center space-x-0 space-y-2 md:space-x-4 md:space-y-0">
<div class="text-white">온도</div>
<div class="text-xl flex items-center space-x-2">
<div>
<%= number_field_tag "schedule[#{s.id}][temperature]", s.temperature, step: "0.1", inputmode: "decimal", class: "input-style" %>
</div>
<div class="text-white text-xl leading-8">°C</div>
</div>
</div>
</div>
<div class="flex items-center space-x-6 basis-1/3 justify-end">
<!-- 사용 여부 -->
<div class="flex flex-col md:flex-row items-center space-x-0 space-y-2 md:space-x-4 md:space-y-0">
<div class="text-white">사용여부</div>
<label class="relative inline-flex items-center cursor-pointer">
<%= check_box_tag "schedule[#{s.id}][is_active]", "1", s.is_active == true || s.is_active == 1, class: "sr-only peer" %>
<div class="toggle_style"></div>
<div class="toggle_btn"></div>
</label>
</div>
<!-- 삭제 -->
<%= link_to "삭제", schedule_path(s), <%= link_to "삭제", schedule_path(s),
data: { data: {
turbo_method: :delete, turbo_method: :delete,
turbo_confirm: "정말 삭제하시겠습니까?" turbo_confirm: "정말 삭제하시겠습니까?"
}, },
class: "btn bg-danger text-sm" %> class: "btn bg-danger text-sm" %>
</div> </td>
</li> </tr>
<% end %> <% end %>
</ul> </tbody>
</table>
</div> </div>
<% end %> <% end %>
<div class="flex p-4 space-x-4"> <div class="flex p-4 space-x-4">

View File

@ -1,70 +1,30 @@
<div class="flex flex-col h-full divide-y divide-base-border text-white"> <div class="flex flex-col h-full divide-y divide-base-border text-white">
<div class="flex flex-col flex-1 space-y-4 overflow-y-hidden"> <div class="flex flex-col flex-1 p-4 space-y-4 overflow-y-hidden">
<div class="overflow-y-auto divide-y divide-base-border"> <div class="overflow-y-auto space-y-4">
<div class="flex justify-between p-4"> <div class="flex justify-between">
<div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div> <div class="text-2xl font-bold"><%= @controller.name %> 컨트롤러</div>
<%= link_to "수정", schedule_edit_schedule_path(@controller.id), class: "btn bg-default-slate" %> <%= link_to "수정", schedule_edit_schedule_path(@controller.id), class: "btn bg-default-slate" %>
</div> </div>
<ul class="divide-y divide-base-border"> <table class="base-table">
<% @schedule.each do |s| %> <thead>
<li class="flex justify-between items-center px-4 py-2 space-x-4"> <tr>
<div class="flex items-center space-x-6"> <th>시간</th>
<!-- 시간 --> <th>분</th>
<div class="flex flex-col md:flex-row items-baseline space-x-2"> <th>사용여부</th>
<div class="text-white">시간</div> <th>온도</th>
<div class="text-3xl flex items-baseline space-x-1"> </tr>
<div><%= s.hour.to_s.rjust(2, '0') %></div> </thead>
<div>:</div> <tbody>
<div><%= s.minute.to_s.rjust(2, '0') %></div> <% @schedule.each do |s| %>
</div> <tr>
</div> <td><%= s.hour %>시</td>
<td><%= s.minute %>분</td>
<!-- 온도 --> <td><%= s.is_active %></td>
<div class="flex flex-col md:flex-row items-baseline space-x-4"> <td><%= s.temperature %> °C</td>
<div class="text-white">온도</div> </tr>
<div class="text-3xl flex items-end space-x-2"> <% end %>
<div><%= s.temperature %></div> </tbody>
<div class="text-white text-xl leading-8">°C</div> </table>
</div>
</div>
</div>
<!-- 사용 여부 -->
<div class="flex flex-col md:flex-row items-baseline space-x-4">
<div class="text-white mb-1">사용여부</div>
<div class="text-3xl">
<%#= s.is_active %>
<% if s.is_active %>
<i class="fa-solid fa-check text-notice"></i>
<% else %>
<i class="fa-solid fa-xmark text-danger"></i>
<% end %>
</div>
</div>
</li>
<% end %>
</ul>
<!-- <table class="base-table">-->
<!-- <thead>-->
<!-- <tr>-->
<!-- <th>시간</th>-->
<!-- <th>분</th>-->
<!-- <th>사용여부</th>-->
<!-- <th>온도</th>-->
<!-- </tr>-->
<!-- </thead>-->
<!-- <tbody>-->
<%# @schedule.each do |s| %>
<!-- <tr>-->
<!-- <td><%#= s.hour %>시</td>-->
<!-- <td><%#= s.minute %>분</td>-->
<!-- <td><%#= s.is_active %></td>-->
<!-- <td><%#= s.temperature %> °C</td>-->
<!-- </tr>-->
<%# end %>
<!-- </tbody>-->
<!-- </table>-->
</div> </div>
</div> </div>
</div> </div>

View File

@ -22,13 +22,13 @@ begin
end end
end end
rescue rescue
# error_message = "[#{Time.now}] #{mode} 실행 실패 (station_id: #{controller_id}, value: #{value})" error_message = "[#{Time.now}] #{mode} 실행 실패 (station_id: #{controller_id}, value: #{value})"
# res = Sms.send_one( res = Sms.send_one(
# { {
# to: '01062619801', to: '01062619801',
# from: '01062619801', from: '01062619801',
# text: error_message text: error_message
# } }
# ) )
# puts res puts res
end end