diff --git a/hbs2-git/hbs2-git-client-lib/HBS2/Git/Client/Config.hs b/hbs2-git/hbs2-git-client-lib/HBS2/Git/Client/Config.hs index 11716d4e..66ec64ae 100644 --- a/hbs2-git/hbs2-git-client-lib/HBS2/Git/Client/Config.hs +++ b/hbs2-git/hbs2-git-client-lib/HBS2/Git/Client/Config.hs @@ -38,9 +38,14 @@ getConfigDir = do getManifest :: GitPerks m => m (Text, Text, Maybe Text) getManifest = do dir <- getConfigDir + + dirFull <- expandPath dir + let mf = dir "manifest" - let defname = takeFileName (takeDirectory dir) & Text.pack + -- directory/.hbs2-git/manifest + -- so, it should be: + let defname = takeFileName (takeDirectory dirFull) & Text.pack let defbrief = "n/a" content <- liftIO (try @_ @IOException $ readFile mf) @@ -88,3 +93,4 @@ export include "refs/heads/main" export exclude "refs/heads/*" export tags |] + diff --git a/hbs2-git/hbs2-git-oracle/lib/HBS2/Git/Oracle/Html.hs b/hbs2-git/hbs2-git-oracle/lib/HBS2/Git/Oracle/Html.hs index efcad790..5833c616 100644 --- a/hbs2-git/hbs2-git-oracle/lib/HBS2/Git/Oracle/Html.hs +++ b/hbs2-git/hbs2-git-oracle/lib/HBS2/Git/Oracle/Html.hs @@ -5,7 +5,8 @@ import HBS2.Git.Oracle.State import Data.HashMap.Strict (HashMap) -import Lucid (Html,HtmlT,toHtml,toHtmlRaw,renderBS) +import Lucid hiding (for_) +import Lucid.Base import Lucid.Html5 hiding (for_) import Data.Text (Text) @@ -15,7 +16,7 @@ import Data.HashMap.Strict qualified as HM import Data.ByteString.Lazy import Text.Pandoc import Text.Pandoc.Error (handleError) - +import Text.InterpolatedString.Perl6 (qc) markdownToHtml :: Text -> Either PandocError String markdownToHtml markdown = runPure $ do @@ -29,6 +30,14 @@ renderMarkdown markdown = case markdownToHtml markdown of Right html -> toHtmlRaw $ Text.pack html +-- FIXME: move-to-hbs2-browser-lib +hyper_ :: Text -> Attribute +hyper_ = makeAttribute "_" + +-- FIXME: move-to-hbs2-browser-lib +onClickCopy :: Text -> Attribute +onClickCopy s = hyper_ [qc|on click writeText('{s}') into the navigator's clipboard|] + renderEntries :: Monad m => HashMap Text Text -> [(HashVal, Text, Text, Word64)] -> m ByteString renderEntries args items = pure $ renderBS do wrapped do @@ -47,12 +56,13 @@ renderEntries args items = pure $ renderBS do let s = if Text.length n > 2 then n else "unnamed" let refpart = Text.take 8 $ Text.pack $ show $ pretty h + let ref = Text.pack $ show $ pretty h div_ [class_ "repo-list-item"] do div_ [class_ "repo-info"] do - h2_ $ a_ [href_ ""] $ toHtml (s <> "-" <> refpart) + h2_ $ a_ [href_ "", onClickCopy ref] $ toHtml (s <> "-" <> refpart) - a_ [href_ ""] (toHtml (show $ pretty h)) + a_ [href_ "", hyper_ ""] (toHtml (show $ pretty h)) renderMarkdown b diff --git a/hbs2-peer/app/Browser/Root.hs b/hbs2-peer/app/Browser/Root.hs index 27759d7a..15d09ef6 100644 --- a/hbs2-peer/app/Browser/Root.hs +++ b/hbs2-peer/app/Browser/Root.hs @@ -56,11 +56,13 @@ input[type="search"] { button.search { background: url('/icon/refresh.svg') no-repeat center center; background-size: 24px 24px; - fill: white; min-width: 32px; height: 2.5rem; } +button.search svg { +} + body, html { margin: 0; height: 100%; @@ -243,6 +245,7 @@ rootPage content = do meta_ [name_ "viewport", content_ "width=device-width, initial-scale=1.0"] -- link_ [rel_ "stylesheet", href_"/css/pico.min.css"] link_ [rel_ "stylesheet", href_ "https://cdn.jsdelivr.net/npm/@picocss/pico@2.0.6/css/pico.min.css"] + script_ [src_ "https://unpkg.com/hyperscript.org@0.9.12"] "" myCss body_ do