File tree Expand file tree Collapse file tree 15 files changed +96
-116
lines changed
Expand file tree Collapse file tree 15 files changed +96
-116
lines changed Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ local P = require("plenary.path")
33
44_Lc_state = {
55 menu = nil , --- @type lc.ui.Menu
6- questions = {}, --- @type lc .ui.Question []
6+ questions = {}, --- @type leet .ui.Problem []
77}
88
99local lazy_plugs = {}
Original file line number Diff line number Diff line change 11local Button = require (" leetcode.ui.menu.button" )
22local markup = require (" markup" )
33
4- return markup .Component (function (self )
5- local page = self .props
4+ return markup .Component ({
5+ render = function (self )
6+ local page = self .props
67
7- return Button ({
8- icon = " " ,
9- title = " Back" ,
10- key = " q" ,
11- page = page ,
12- })
13- end )
8+ return Button ({
9+ icon = " " ,
10+ title = " Back" ,
11+ key = " q" ,
12+ page = page ,
13+ })
14+ end ,
15+ })
Original file line number Diff line number Diff line change @@ -4,15 +4,6 @@ local log = require("leetcode.logger")
44return markup .Component (function (self )
55 local p = self .props
66
7- local left = {
8- markup .Inline (p .icon , " leetcode_menu_button_icon" ),
9- markup .Inline (p .title , " leetcode_menu_button_title" ),
10- }
11-
12- if p .nested then
13- table.insert (left , markup .Inline (" " , " leetcode_menu_button_nested" ))
14- end
15-
167 local on_submit = p .page and function ()
178 _Lc_state .menu :set_page (p .page )
189 end or p .on_submit
@@ -26,7 +17,11 @@ return markup.Component(function(self)
2617 markup .HFlex ({
2718 spacing = 1 ,
2819 size = { width = 50 },
29- children = left ,
20+ children = {
21+ markup .Inline (p .icon , " leetcode_menu_button_icon" ),
22+ markup .Inline (p .title , " leetcode_menu_button_title" ),
23+ markup .If (p .nested , markup .Inline (" " , " leetcode_menu_button_nested" )),
24+ },
3025 }),
3126 markup .Inline (p .key , " leetcode_menu_button_key" ),
3227 },
Original file line number Diff line number Diff line change 11local markup = require (" markup" )
2- local log = require (" leetcode.logger" )
32
43return markup .Component (function (self )
54 return markup .Flex ({
Original file line number Diff line number Diff line change 11local markup = require (" markup" )
22local config = require (" leetcode.config" )
33
4- return function ()
4+ return markup . Component ( function ()
55 return markup .Inline ({
66 markup .Inline (" signed in as: " , " leetcode_menu_footer" ),
77 markup .Inline (config .auth .name or " no user" , " leetcode_menu_footer_username" ),
88 })
9- end
9+ end )
Original file line number Diff line number Diff line change @@ -11,6 +11,6 @@ local ascii = {
1111 [[ |________/\_______/\_______/ \___/ \______/ \______/ \_______/\_______/]] ,
1212}
1313
14- return function ()
14+ return markup . Component ( function ()
1515 return markup .Block (vim .tbl_map (markup .Block , ascii ), " leetcode_menu_header" )
16- end
16+ end )
Original file line number Diff line number Diff line change @@ -25,20 +25,18 @@ function Menu:set_page(page)
2525end
2626
2727function Menu :render ()
28- self : set_body ( {
28+ Menu . super . render ( self , {
2929 markup .Flex ({
3030 margin = { top = 3 },
3131 align = " center" ,
3232 spacing = 3 ,
3333 children = {
3434 Header (),
35- Nav ({ page = self .page } ),
35+ Nav (self .page ),
3636 Footer (),
3737 },
3838 }),
3939 })
40-
41- Menu .super .render (self )
4240end
4341
4442function Menu :draw ()
Original file line number Diff line number Diff line change @@ -2,14 +2,14 @@ local markup = require("markup")
22local Title = require (" leetcode.ui.menu.title" )
33
44return markup .Component (function (self )
5- local page = self .props . page
5+ local page = self .props
66 local Items = require (" leetcode.ui.menu.nav." .. page )
77
88 return markup .Flex ({
99 spacing = 1 ,
1010 align = " center" ,
1111 children = {
12- Title ({ page = page } ),
12+ Title (page ),
1313 Items (),
1414 },
1515 })
Original file line number Diff line number Diff line change 11local markup = require (" markup" )
22
3- return markup .Component ({
4- render = function ()
5- return markup .Inline (" loading..." )
6- end ,
7- })
3+ return markup .Component (function ()
4+ return markup .Inline (" loading..." )
5+ end )
Original file line number Diff line number Diff line change @@ -5,41 +5,42 @@ local Button = require("leetcode.ui.menu.button")
55
66return markup .Component (function ()
77 return Buttons ({
8- Button ({
9- icon = " " ,
10- title = " Problems" ,
11- key = " p" ,
12- nested = true ,
13- page = " menu.problems" ,
14- }),
15- Button ({
16- icon = " " ,
17- title = " Statistics" ,
18- key = " s" ,
19- nested = true ,
20- page = " menu.statistics" ,
21- }),
22- Button ({
23- icon = " " ,
24- title = " Cookie" ,
25- key = " i" ,
26- nested = true ,
27- page = " menu.cookie" ,
28- }),
29- Button ({
30- icon = " " ,
31- title = " Cache" ,
32- key = " c" ,
33- nested = true ,
34- page = " menu.cache" ,
35- }),
36- Button ({
37- icon = " " ,
38- title = " Exit" ,
39- key = " q" ,
40- on_submit = function ()
41- require (" leetcode" ).stop ()
42- end ,
43- }),
8+ markup .Inline (" 123" ),
9+ -- -- Button({
10+ -- -- icon = "",
11+ -- -- title = "Problems",
12+ -- -- key = "p",
13+ -- -- nested = true,
14+ -- -- page = "menu.problems",
15+ -- -- }),
16+ -- -- Button({
17+ -- -- icon = "",
18+ -- -- title = "Statistics",
19+ -- -- key = "s",
20+ -- -- nested = true,
21+ -- -- page = "menu.statistics",
22+ -- -- }),
23+ -- -- Button({
24+ -- -- icon = "",
25+ -- -- title = "Cookie",
26+ -- -- key = "i",
27+ -- -- nested = true,
28+ -- -- page = "menu.cookie",
29+ -- -- }),
30+ -- -- Button({
31+ -- -- icon = "",
32+ -- -- title = "Cache",
33+ -- -- key = "c",
34+ -- -- nested = true,
35+ -- -- page = "menu.cache",
36+ -- -- }),
37+ -- -- Button({
38+ -- -- icon = "",
39+ -- -- title = "Exit",
40+ -- -- key = "q",
41+ -- -- on_submit = function()
42+ -- -- require("leetcode").stop()
43+ -- -- end,
44+ -- -- }),
4445 })
4546end )
You can’t perform that action at this time.
0 commit comments