diff --git a/src/main-window.ui b/src/main-window.ui index 6007934..b86dd08 100644 --- a/src/main-window.ui +++ b/src/main-window.ui @@ -43,22 +43,20 @@ - False False False - - - start - - - + Projects - 6 + + + + start + diff --git a/src/widgets/project-item.ui b/src/widgets/project-item.ui index 1ee5f72..5057023 100644 --- a/src/widgets/project-item.ui +++ b/src/widgets/project-item.ui @@ -72,7 +72,8 @@ - 12 + 6 + 6 diff --git a/src/widgets/request-item.ui b/src/widgets/request-item.ui index 33c453c..573ac6e 100644 --- a/src/widgets/request-item.ui +++ b/src/widgets/request-item.ui @@ -11,10 +11,9 @@ - 6 + 0.5 diff --git a/src/widgets/request_item.py b/src/widgets/request_item.py index 52fdfcb..dbe6ae4 100644 --- a/src/widgets/request_item.py +++ b/src/widgets/request_item.py @@ -20,6 +20,14 @@ 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') class RequestItem(Gtk.Box): @@ -38,7 +46,9 @@ class RequestItem(Gtk.Box): def __init__(self, saved_request): super().__init__() 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) # Add click gesture for loading diff --git a/src/window.py b/src/window.py index bc0e7a2..081ba91 100644 --- a/src/window.py +++ b/src/window.py @@ -203,6 +203,18 @@ class RosterWindow(Adw.ApplicationWindow): color: @accent_color; 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(