diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/model/src/AppEvent.scala b/ui/model/src/AppEvent.scala deleted file mode 100644 index 1ddc218..0000000 --- a/ui/model/src/AppEvent.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum AppEvent: - case NavigateTo(href: String) diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/model/src/AppEvent.scala b/ui/model/src/AppEvent.scala deleted file mode 100644 index 1ddc218..0000000 --- a/ui/model/src/AppEvent.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum AppEvent: - case NavigateTo(href: String) diff --git a/ui/model/src/HighlightColor.scala b/ui/model/src/HighlightColor.scala deleted file mode 100644 index 0efda68..0000000 --- a/ui/model/src/HighlightColor.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum HighlightColor: - case Red, Green, Yellow, Amber, Orange, Gray diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/model/src/AppEvent.scala b/ui/model/src/AppEvent.scala deleted file mode 100644 index 1ddc218..0000000 --- a/ui/model/src/AppEvent.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum AppEvent: - case NavigateTo(href: String) diff --git a/ui/model/src/HighlightColor.scala b/ui/model/src/HighlightColor.scala deleted file mode 100644 index 0efda68..0000000 --- a/ui/model/src/HighlightColor.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum HighlightColor: - case Red, Green, Yellow, Amber, Orange, Gray diff --git a/ui/model/src/Icons.scala b/ui/model/src/Icons.scala deleted file mode 100644 index 8735630..0000000 --- a/ui/model/src/Icons.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum Icon: - case Bell diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/model/src/AppEvent.scala b/ui/model/src/AppEvent.scala deleted file mode 100644 index 1ddc218..0000000 --- a/ui/model/src/AppEvent.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum AppEvent: - case NavigateTo(href: String) diff --git a/ui/model/src/HighlightColor.scala b/ui/model/src/HighlightColor.scala deleted file mode 100644 index 0efda68..0000000 --- a/ui/model/src/HighlightColor.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum HighlightColor: - case Red, Green, Yellow, Amber, Orange, Gray diff --git a/ui/model/src/Icons.scala b/ui/model/src/Icons.scala deleted file mode 100644 index 8735630..0000000 --- a/ui/model/src/Icons.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum Icon: - case Bell diff --git a/ui/model/src/ItemList.scala b/ui/model/src/ItemList.scala deleted file mode 100644 index 76e9dac..0000000 --- a/ui/model/src/ItemList.scala +++ /dev/null @@ -1,27 +0,0 @@ -package works.iterative -package ui.model - -import core.* - -case class ItemList( - items: List[ListSection] -) - -case class ItemProp( - text: PlainOneLine, - icon: Option[Icon] = None -) - -case class ListSection( - title: PlainOneLine, - items: List[ListItem] -) - -case class ListItem( - title: PlainOneLine, - href: String, - label: Option[Label] = None, - leftProps: List[ItemProp] = Nil, - rightProp: Option[ItemProp] = None, - categories: List[String] = Nil -) diff --git a/ui/components/src/ui/components/tailwind/ComponentContext.scala b/ui/components/src/ui/components/tailwind/ComponentContext.scala index 3687acd..627656c 100644 --- a/ui/components/src/ui/components/tailwind/ComponentContext.scala +++ b/ui/components/src/ui/components/tailwind/ComponentContext.scala @@ -1,9 +1,7 @@ package works.iterative package ui.components.tailwind -import com.raquo.airstream.core.Observer import works.iterative.core.MessageCatalogue trait ComponentContext: - def eventBus: Observer[ui.model.AppEvent] def messages: MessageCatalogue diff --git a/ui/components/src/ui/components/tailwind/Icons.scala b/ui/components/src/ui/components/tailwind/Icons.scala index 7e8a7f6..cbfc810 100644 --- a/ui/components/src/ui/components/tailwind/Icons.scala +++ b/ui/components/src/ui/components/tailwind/Icons.scala @@ -7,7 +7,6 @@ import com.raquo.laminar.builders.SvgBuilders import com.raquo.laminar.keys.ReactiveSvgAttr import com.raquo.domtypes.generic.codecs.StringAsIsCodec -import works.iterative.ui.model.Icon import com.raquo.laminar.nodes.ReactiveSvgElement object Icons: @@ -355,12 +354,4 @@ ) end solid - - class IconComponent(extraClasses: String) - extends SvgComponent[org.scalajs.dom.svg.Element, Icon]: - def render(i: Icon): SvgElement = - import Icon.* - i match - case Bell => outline.bell(extraClasses) - end Icons diff --git a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala b/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala deleted file mode 100644 index 40e4728..0000000 --- a/ui/components/src/ui/components/tailwind/lists/stacked_lists/WithRightJustifiedSecondColumn.scala +++ /dev/null @@ -1,118 +0,0 @@ -package works.iterative -package ui -package components.tailwind -package lists.stacked_lists - -import com.raquo.laminar.api.L.{*, given} - -import com.raquo.laminar.nodes.ReactiveHtmlElement -import org.scalajs.dom.html.{UList, LI, Paragraph} -import works.iterative.ui.model.AppEvent -import model.{ListItem, ItemList, Label, ItemProp, HighlightColor} - -object WithRightJustifiedSecondColumn: - given Icons.IconComponent("h-5 w-5") - def leftProp(i: Int): HtmlComponent[Paragraph, ItemProp] = - (prop: ItemProp) => - p( - cls( - "mt-2 flex items-center text-sm text-gray-500 sm:mt-0" - ), - cls( - if prop.icon.isDefined then "sm:ml-6" - else if i != 0 then "sm:ml-2" - else "" - ), - prop.icon.map(_.element), - prop.text.toString - ) - - val rightProp: HtmlComponent[org.scalajs.dom.html.Div, ItemProp] = - (prop: ItemProp) => - div( - cls("mt-2 flex items-center text-sm text-gray-500 sm:mt-0"), - prop.icon.map(_.element), - prop.text.toString - ) - - given HtmlComponent[Paragraph, Label] = - (l: Label) => - p( - cls := "px-2 inline-flex text-xs leading-5 font-semibold rounded-full", - // TODO: macros - // cls(colorClass(color)), - cls := (l.color match { - case HighlightColor.Red => "text-red-800 bg-red-100" - case HighlightColor.Amber => "text-amber-800 bg-amber-100" - case HighlightColor.Green => "text-green-800 bg-green-100" - case HighlightColor.Yellow => "text-yellow-800 bg-yellow-100" - case HighlightColor.Orange => "text-orange-800 bg-orange-100" - case HighlightColor.Gray => "text-gray-800 bg-gray-100" - }), - l.text - ) - - val defaultItem: ComponentContext ?=> HtmlComponent[LI, ListItem] = - (i: ListItem) => - li( - a( - href := i.href, - onClick.preventDefault.mapTo(AppEvent.NavigateTo(i.href)) --> summon[ - ComponentContext - ].eventBus, - cls := "block hover:bg-gray-50", - div( - cls := "px-4 py-4 sm:px-6 items-center flex", - div( - cls := "min-w-0 flex-1 pr-4", - div( - cls := "flex items-center justify-between", - p( - cls := "text-sm font-medium text-indigo-600 truncate", - i.title.toString - ), - div( - cls := "ml-2 flex-shrink-0 flex", - i.label.map(_.element) - ) - ), - div( - cls := "mt-2 sm:flex sm:justify-between", - div( - cls("sm:flex"), - i.leftProps.zipWithIndex.map { case (p, i) => - leftProp(i).render(p) - } - ), - i.rightProp.map(rightProp.render(_)) - ) - ) - // r.farRight - ) - ) - ) - - def defaultList(using - HtmlComponent[LI, ListItem] - ): ComponentContext ?=> HtmlComponent[org.scalajs.dom.html.Div, ItemList] = - (l: ItemList) => - div( - cls := "bg-white shadow overflow-hidden sm:rounded-md", - l.items.map(i => { - div( - cls("relative"), - h3( - cls( - "z-10 sticky top-0 border-t border-b border-gray-200 bg-gray-50 px-6 py-1 text-sm font-medium text-gray-500" - ), - i.title.toString - ), - ul( - role := "list", - cls := "divide-y divide-gray-200", - cls("relative"), - i.items.map(_.element) - ) - ) - }) - ) diff --git a/ui/model/src/AppEvent.scala b/ui/model/src/AppEvent.scala deleted file mode 100644 index 1ddc218..0000000 --- a/ui/model/src/AppEvent.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum AppEvent: - case NavigateTo(href: String) diff --git a/ui/model/src/HighlightColor.scala b/ui/model/src/HighlightColor.scala deleted file mode 100644 index 0efda68..0000000 --- a/ui/model/src/HighlightColor.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum HighlightColor: - case Red, Green, Yellow, Amber, Orange, Gray diff --git a/ui/model/src/Icons.scala b/ui/model/src/Icons.scala deleted file mode 100644 index 8735630..0000000 --- a/ui/model/src/Icons.scala +++ /dev/null @@ -1,4 +0,0 @@ -package works.iterative.ui.model - -enum Icon: - case Bell diff --git a/ui/model/src/ItemList.scala b/ui/model/src/ItemList.scala deleted file mode 100644 index 76e9dac..0000000 --- a/ui/model/src/ItemList.scala +++ /dev/null @@ -1,27 +0,0 @@ -package works.iterative -package ui.model - -import core.* - -case class ItemList( - items: List[ListSection] -) - -case class ItemProp( - text: PlainOneLine, - icon: Option[Icon] = None -) - -case class ListSection( - title: PlainOneLine, - items: List[ListItem] -) - -case class ListItem( - title: PlainOneLine, - href: String, - label: Option[Label] = None, - leftProps: List[ItemProp] = Nil, - rightProp: Option[ItemProp] = None, - categories: List[String] = Nil -) diff --git a/ui/model/src/Label.scala b/ui/model/src/Label.scala deleted file mode 100644 index 6d6f13f..0000000 --- a/ui/model/src/Label.scala +++ /dev/null @@ -1,5 +0,0 @@ -package works.iterative.ui.model - -// TODO: Rename to Tag? Metals does not like Label for some reason, never imports it as code action -// A conflict with something in Laminar -case class Label(color: HighlightColor, text: String)