<commit_before>;;;; skill-panel.lisp

(in-package #:monster-avengers.simple-web)

(eval-when (:compile-toplevel :load-toplevel :execute)
  (enable-jsx-reader))

(def-widget skill-item (language effect update-callback destructor)
    ()
  #jsx(with-slots (name skills) (aref skill-systems (@ effect id))
	(:li ((class-name "list-group-item"))
	     (:div ((class-name "row"))
		   (:div ((class-name "col-md-4 col-sm-4 col-xs-4"))
                         (lang-text ("zh" (@ name jp))
                                    ("en" (@ name en))))
		   (:div ((class-name "col-md-6 col-sm-6 col-xs-6"))
			 (:select ((class-name "form-control")
                                   (value (@ effect active))
				   (on-change (lambda (e)
                                                (funcall update-callback
                                                         (@ effect id)
                                                         (@ e target value)))))
				  (chain skills 
					 (map (lambda (skill id)
						(:option ((value id))
							 (lang-text ("zh" (@ skill name jp))
                                                                    ("en" (@ skill name en)))))))))
		   (:div ((class-name "col-md-2 col-sm-2 col-xs-2"))
			 (:button ((class-name "btn btn-default")
				   (on-click (lambda () 
					       (funcall destructor (@ effect id)))))
				  (:span ((class-name "glyphicon glyphicon-remove")))))))))

(def-widget skill-panel (language change-callback effects)
    ((state (selected 13))
     (add-skill ()
		(funcall change-callback (local-state selected) 0)
		nil)
     (remove-skill (skill-id)
		   (funcall change-callback skill-id -1)
		   nil))
  #jsx(:div ((class-name "panel panel-default"))
            (:div ((class-name "panel-heading"))
                  (lang-text ("en" "Skills")
                             ("zh" "技能")))
            (:ul ((class-name "list-group"))
		 (chain effects
			(map (lambda (effect) 
			       (:skill-item ((effect effect)
                                             (:language language)
					     (update-callback change-callback)
					     (destructor (@ this remove-skill))))))))
            (:div ((class-name "panel-body"))
                  (:div ((class-name "input-group"))
                        (:select ((class-name "form-control")
                                  (value (local-state selected))
				  (on-change (lambda (e)
                                               (chain this 
                                                      (set-state (create 
                                                                  selected
                                                                  (@ e target value)))))))
                                 (chain skill-systems 
                                        (filter (lambda (skill id)
                                                  (> id 0)))
                                        (sort (lambda (x y)
                                                (if (< (@ x name en) (@ y name en))
                                                    -1 1)))
					(map (lambda (system id)
					       (:option ((value (@ system id)))
                                                        (lang-text ("zh" (@ system name jp))
                                                                   ("en" (@ system name en))))))))
                        (:div ((class-name "input-group-btn"))
                              (:button ((class-name "btn btn-info")
                                        (disabled (>= (@ effects length) 5))
					(on-click (@ this add-skill)))
                                       (lang-text ("en" "Add")
                                                  ("zh" "添加"))))))))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (disable-jsx-reader))<commit_msg>increase the maximum skill in query to 9<commit_after>;;;; skill-panel.lisp

(in-package #:monster-avengers.simple-web)

(eval-when (:compile-toplevel :load-toplevel :execute)
  (enable-jsx-reader))

(def-widget skill-item (language effect update-callback destructor)
    ()
  #jsx(with-slots (name skills) (aref skill-systems (@ effect id))
	(:li ((class-name "list-group-item"))
	     (:div ((class-name "row"))
		   (:div ((class-name "col-md-4 col-sm-4 col-xs-4"))
                         (lang-text ("zh" (@ name jp))
                                    ("en" (@ name en))))
		   (:div ((class-name "col-md-6 col-sm-6 col-xs-6"))
			 (:select ((class-name "form-control")
                                   (value (@ effect active))
				   (on-change (lambda (e)
                                                (funcall update-callback
                                                         (@ effect id)
                                                         (@ e target value)))))
				  (chain skills 
					 (map (lambda (skill id)
						(:option ((value id))
							 (lang-text ("zh" (@ skill name jp))
                                                                    ("en" (@ skill name en)))))))))
		   (:div ((class-name "col-md-2 col-sm-2 col-xs-2"))
			 (:button ((class-name "btn btn-default")
				   (on-click (lambda () 
					       (funcall destructor (@ effect id)))))
				  (:span ((class-name "glyphicon glyphicon-remove")))))))))

(def-widget skill-panel (language change-callback effects)
    ((state (selected 13))
     (add-skill ()
		(funcall change-callback (local-state selected) 0)
		nil)
     (remove-skill (skill-id)
		   (funcall change-callback skill-id -1)
		   nil))
  #jsx(:div ((class-name "panel panel-default"))
            (:div ((class-name "panel-heading"))
                  (lang-text ("en" "Skills")
                             ("zh" "技能")))
            (:ul ((class-name "list-group"))
		 (chain effects
			(map (lambda (effect) 
			       (:skill-item ((effect effect)
                                             (:language language)
					     (update-callback change-callback)
					     (destructor (@ this remove-skill))))))))
            (:div ((class-name "panel-body"))
                  (:div ((class-name "input-group"))
                        (:select ((class-name "form-control")
                                  (value (local-state selected))
				  (on-change (lambda (e)
                                               (chain this 
                                                      (set-state (create 
                                                                  selected
                                                                  (@ e target value)))))))
                                 (chain skill-systems 
                                        (filter (lambda (skill id)
                                                  (> id 0)))
                                        (sort (lambda (x y)
                                                (if (< (@ x name en) (@ y name en))
                                                    -1 1)))
					(map (lambda (system id)
					       (:option ((value (@ system id)))
                                                        (lang-text ("zh" (@ system name jp))
                                                                   ("en" (@ system name en))))))))
                        (:div ((class-name "input-group-btn"))
                              (:button ((class-name "btn btn-info")
                                        (disabled (>= (@ effects length) 9))
					(on-click (@ this add-skill)))
                                       (lang-text ("en" "Add")
                                                  ("zh" "添加"))))))))

(eval-when (:compile-toplevel :load-toplevel :execute)
  (disable-jsx-reader))
{'fraction_non_alphanumeric': 0.1397470994655195, 'fraction_numerical': 0.004562638508669013, 'mean_word_length': 1.0232067510548524, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 78, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4759195', 'n_tokens_mistral': 2015, 'n_tokens_neox': 1760, 'n_words': 476}