From a9195048be5e8e79e732bc2a9234b85c4665e4d1 Mon Sep 17 00:00:00 2001 From: Dmitry Zuikov Date: Wed, 24 Apr 2024 07:54:37 +0300 Subject: [PATCH] wip --- .../assets/css/custom.css | 3 +- .../src/HBS2/Git/Web/Html/Root.hs | 87 +++++++++++-------- 2 files changed, 51 insertions(+), 39 deletions(-) diff --git a/hbs2-git/hbs2-git-dashboard-assets/assets/css/custom.css b/hbs2-git/hbs2-git-dashboard-assets/assets/css/custom.css index acc73fed..bf4de352 100644 --- a/hbs2-git/hbs2-git-dashboard-assets/assets/css/custom.css +++ b/hbs2-git/hbs2-git-dashboard-assets/assets/css/custom.css @@ -194,6 +194,7 @@ div .repo-list-item { gap: 2rem; margin-bottom: 0.5em; padding-right: 1rem; + font-size: 0.85rem; } .attrname, { @@ -202,7 +203,7 @@ div .repo-list-item { } .attrval { - flex-basis: 70%; + flex-basis: 80%; text-align: right; } diff --git a/hbs2-git/hbs2-git-dashboard/src/HBS2/Git/Web/Html/Root.hs b/hbs2-git/hbs2-git-dashboard/src/HBS2/Git/Web/Html/Root.hs index 6140c7ca..1a1117ad 100644 --- a/hbs2-git/hbs2-git-dashboard/src/HBS2/Git/Web/Html/Root.hs +++ b/hbs2-git/hbs2-git-dashboard/src/HBS2/Git/Web/Html/Root.hs @@ -275,38 +275,6 @@ instance ToHtml GitRef where toHtml (GitRef s)= toHtml s toHtmlRaw (GitRef s)= toHtmlRaw s -instance ToHtml (WithTime RepoListItem) where - toHtmlRaw = pure mempty - - toHtml (WithTime t it@RepoListItem{..}) = do - - let now = t - - let locked = isJust $ coerce @_ @(Maybe HashRef) rlRepoGK0 - - let url = toURL (RepoPage (CommitsTab Nothing) (coerce @_ @(LWWRefKey 'HBS2Basic) rlRepoLww)) - -- path ["repo", Text.unpack $ view rlRepoLwwAsText it] - let t = fromIntegral $ coerce @_ @Word64 rlRepoSeq - - let updated = agePure t now - - div_ [class_ "repo-list-item"] do - div_ [class_ "repo-info", style_ "flex: 1; flex-basis: 70%;"] do - - h2_ [class_ "xclip", onClickCopy (view rlRepoLwwAsText it)] $ toHtml rlRepoName - p_ $ a_ [href_ url] (toHtml $ view rlRepoLwwAsText it) - - toHtml rlRepoBrief - - div_ [ ] do - div_ [ class_ "attr" ] do - div_ [ class_ "attrname"] (toHtml updated) - - when locked do - div_ [ class_ "attr" ] do - div_ [ class_ "attrval icon"] do - img_ [src_ "/icon/lock-closed.svg"] - rootPage :: Monad m => HtmlT m () -> HtmlT m () rootPage content = do doctypehtml_ do @@ -328,7 +296,6 @@ rootPage content = do content - dashboardRootPage :: (DashBoardPerks m, MonadReader DashBoardEnv m) => HtmlT m () dashboardRootPage = rootPage do @@ -352,8 +319,46 @@ dashboardRootPage = rootPage do section_ [id_ "repo-search-results"] do - for_ items $ \item@RepoListItem{..} -> do - toHtml (WithTime now item) + for_ items $ \it@RepoListItem{..} -> do + + let locked = isJust $ coerce @_ @(Maybe HashRef) rlRepoGK0 + + let url = toURL (RepoPage (CommitsTab Nothing) (coerce @_ @(LWWRefKey 'HBS2Basic) rlRepoLww)) + -- path ["repo", Text.unpack $ view rlRepoLwwAsText it] + let t = fromIntegral $ coerce @_ @Word64 rlRepoSeq + + let updated = agePure t now + + div_ [class_ "repo-list-item"] do + div_ [class_ "repo-info", style_ "flex: 1; flex-basis: 70%;"] do + + h2_ [class_ "xclip", onClickCopy (view rlRepoLwwAsText it)] do + toHtml rlRepoName + -- when locked $ img_ [src_ "/icon/lock-closed.svg"] + + p_ $ a_ [href_ url] (toHtml $ view rlRepoLwwAsText it) + + toHtml rlRepoBrief + + div_ [ ] do + + div_ [ class_ "attr" ] do + div_ [ class_ "attrname"] "" + div_ [ class_ "attrval"] (toHtml updated) + + when locked do + div_ [ class_ "attr" ] do + div_ [ class_ "attrname"] "encrypted" + div_ [ class_ "attrval"] do + img_ [src_ "/icon/lock-closed.svg"] + + div_ [ class_ "attr" ] do + div_ [ class_ "attrname"] "commits" + div_ [ class_ "attrval"] $ toHtml (show rlRepoCommits) + + div_ [ class_ "attr" ] do + div_ [ class_ "attrname"] "forks" + div_ [ class_ "attrval"] $ toHtml (show rlRepoForks) @@ -669,6 +674,14 @@ repoCommit style lww hash = do let code = renderText (Lucid.formatHtmlBlock fo tokens) toHtmlRaw code + +repoForks :: (DashBoardPerks m, MonadReader DashBoardEnv m) + => LWWRefKey 'HBS2Basic + -> HtmlT m () + +repoForks lww = do + pure mempty + repoCommits :: (DashBoardPerks m, MonadReader DashBoardEnv m) => LWWRefKey 'HBS2Basic -> Either SelectCommitsPred SelectCommitsPred @@ -844,9 +857,7 @@ repoPage tab lww params = rootPage do div_ [class_ "info-block" ] do div_ [ class_ "attr" ] do img_ [src_ "/icon/tree-up.svg"] - small_ do - a_ [ href_ "/"] "back to projects" - + a_ [ href_ "/"] "back to projects" div_ [class_ "info-block" ] do for_ author $ \a -> do