Untitled

Run Settings
LanguageRaku
Language Version
Run Command
use Air::Functional :BASE; use Air::Base; use Air::Component; class File does Component { has $.filename; method download is controller { say "Downloading $.filename !"; } method hx-download(--> Hash()) { :hx-get("$.url-path/download"), } } class FileList does Component { method refresh is controller { self.HTML } method hx-refresh(--> Hash()) { :hx-get("$.url-path/refresh"), :hx-target("tbody"), :hx-swap<innerHTML>, } method HTML { ~ do for $*node.index.keys.sort -> $filename { my $file = File.new(:$filename); tr :register[$file], td( $file.filename ~ "({$file.id})"), td( button :type<submit>, |$file.hx-download, 'Download') } } } # theme my &index = &page.assuming( #:REFRESH(5), title => 'Test DFS', description => 'HTMX, Air, Red, Cro', nav => nav( logo => span( ), # safe '<a href="/">h<b>&Aring;</b>rc</a>' ), widgets => [lightdark], ), ); my $filelist = FileList.new; sub SITE is export { site :register[$filelist], index main [ h3 'Files:'; table :thead[["filename"]], :tbody[[$filelist]]; button :type<submit>, |$filelist.hx-refresh, 'Refresh'; ] }
Editor Settings
Theme
Key bindings
Full width
Lines