Improve sidebar layout: center Projects title, fix padding, add method chips
- Center "Projects" label in sidebar headerbar via title-widget property - Fix asymmetric request list margins (margin-start 12→6, add margin-end 6) - Replace dim method labels with colored chips (GET/POST/PUT/PATCH/DELETE)
This commit is contained in:
parent
728697711c
commit
a6c389edd7
@ -43,22 +43,20 @@
|
|||||||
<!-- Sidebar Header Bar -->
|
<!-- Sidebar Header Bar -->
|
||||||
<child type="top">
|
<child type="top">
|
||||||
<object class="AdwHeaderBar">
|
<object class="AdwHeaderBar">
|
||||||
<property name="show-title">False</property>
|
|
||||||
<property name="show-end-title-buttons">False</property>
|
<property name="show-end-title-buttons">False</property>
|
||||||
<property name="show-start-title-buttons">False</property>
|
<property name="show-start-title-buttons">False</property>
|
||||||
<child type="start">
|
<property name="title-widget">
|
||||||
<object class="GtkWindowControls">
|
|
||||||
<property name="side">start</property>
|
|
||||||
</object>
|
|
||||||
</child>
|
|
||||||
<child type="start">
|
|
||||||
<object class="GtkLabel">
|
<object class="GtkLabel">
|
||||||
<property name="label">Projects</property>
|
<property name="label">Projects</property>
|
||||||
<property name="margin-start">6</property>
|
|
||||||
<style>
|
<style>
|
||||||
<class name="title"/>
|
<class name="title"/>
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
|
</property>
|
||||||
|
<child type="start">
|
||||||
|
<object class="GtkWindowControls">
|
||||||
|
<property name="side">start</property>
|
||||||
|
</object>
|
||||||
</child>
|
</child>
|
||||||
<child type="end">
|
<child type="end">
|
||||||
<object class="GtkButton" id="add_project_button">
|
<object class="GtkButton" id="add_project_button">
|
||||||
|
|||||||
@ -72,7 +72,8 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkListBox" id="requests_listbox">
|
<object class="GtkListBox" id="requests_listbox">
|
||||||
<property name="margin-start">12</property>
|
<property name="margin-start">6</property>
|
||||||
|
<property name="margin-end">6</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="navigation-sidebar"/>
|
<class name="navigation-sidebar"/>
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@ -11,10 +11,9 @@
|
|||||||
|
|
||||||
<child>
|
<child>
|
||||||
<object class="GtkLabel" id="method_label">
|
<object class="GtkLabel" id="method_label">
|
||||||
<property name="width-chars">6</property>
|
<property name="xalign">0.5</property>
|
||||||
<style>
|
<style>
|
||||||
<class name="caption"/>
|
<class name="method-chip"/>
|
||||||
<class name="dim-label"/>
|
|
||||||
</style>
|
</style>
|
||||||
</object>
|
</object>
|
||||||
</child>
|
</child>
|
||||||
|
|||||||
@ -20,6 +20,14 @@
|
|||||||
|
|
||||||
from gi.repository import Gtk, GObject
|
from gi.repository import Gtk, GObject
|
||||||
|
|
||||||
|
_METHOD_CSS = {
|
||||||
|
'GET': 'accent',
|
||||||
|
'POST': 'success',
|
||||||
|
'PUT': 'warning',
|
||||||
|
'PATCH': 'warning',
|
||||||
|
'DELETE': 'error',
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Gtk.Template(resource_path='/cz/bugsy/roster/widgets/request-item.ui')
|
@Gtk.Template(resource_path='/cz/bugsy/roster/widgets/request-item.ui')
|
||||||
class RequestItem(Gtk.Box):
|
class RequestItem(Gtk.Box):
|
||||||
@ -38,7 +46,9 @@ class RequestItem(Gtk.Box):
|
|||||||
def __init__(self, saved_request):
|
def __init__(self, saved_request):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
self.saved_request = saved_request
|
self.saved_request = saved_request
|
||||||
self.method_label.set_text(saved_request.request.method)
|
method = saved_request.request.method
|
||||||
|
self.method_label.set_text(method)
|
||||||
|
self.method_label.add_css_class(_METHOD_CSS.get(method, 'dim-label'))
|
||||||
self.name_label.set_text(saved_request.name)
|
self.name_label.set_text(saved_request.name)
|
||||||
|
|
||||||
# Add click gesture for loading
|
# Add click gesture for loading
|
||||||
|
|||||||
@ -203,6 +203,18 @@ class RosterWindow(Adw.ApplicationWindow):
|
|||||||
color: @accent_color;
|
color: @accent_color;
|
||||||
font-weight: 600;
|
font-weight: 600;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Method chips in sidebar request list */
|
||||||
|
.method-chip {
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 1px 5px;
|
||||||
|
font-size: 0.72em;
|
||||||
|
font-weight: 700;
|
||||||
|
}
|
||||||
|
.method-chip.accent { background-color: alpha(@accent_bg_color, 0.18); }
|
||||||
|
.method-chip.success { background-color: alpha(@success_bg_color, 0.18); }
|
||||||
|
.method-chip.warning { background-color: alpha(@warning_bg_color, 0.18); }
|
||||||
|
.method-chip.error { background-color: alpha(@error_bg_color, 0.18); }
|
||||||
""")
|
""")
|
||||||
|
|
||||||
Gtk.StyleContext.add_provider_for_display(
|
Gtk.StyleContext.add_provider_for_display(
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user