diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..05e5a39 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,485 @@ +root = true + +[*] +charset = utf-8 +end_of_line = crlf +indent_size = 4 +indent_style = space +insert_final_newline = false +max_line_length = 120 +tab_width = 4 +ij_continuation_indent_size = 4 +ij_formatter_off_tag = @formatter:off +ij_formatter_on_tag = @formatter:on +ij_formatter_tags_enabled = true +ij_smart_tabs = false +ij_visual_guides = none +ij_wrap_on_typing = false + +[*.css] +ij_css_align_closing_brace_with_properties = false +ij_css_blank_lines_around_nested_selector = 1 +ij_css_blank_lines_between_blocks = 1 +ij_css_block_comment_add_space = false +ij_css_brace_placement = end_of_line +ij_css_enforce_quotes_on_format = false +ij_css_hex_color_long_format = false +ij_css_hex_color_lower_case = false +ij_css_hex_color_short_format = false +ij_css_hex_color_upper_case = false +ij_css_keep_blank_lines_in_code = 2 +ij_css_keep_indents_on_empty_lines = false +ij_css_keep_single_line_blocks = false +ij_css_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_css_space_after_colon = true +ij_css_space_before_opening_brace = true +ij_css_use_double_quotes = true +ij_css_value_alignment = do_not_align + +[*.sass] +indent_size = 2 +ij_sass_align_closing_brace_with_properties = false +ij_sass_blank_lines_around_nested_selector = 1 +ij_sass_blank_lines_between_blocks = 1 +ij_sass_brace_placement = 0 +ij_sass_enforce_quotes_on_format = false +ij_sass_hex_color_long_format = false +ij_sass_hex_color_lower_case = false +ij_sass_hex_color_short_format = false +ij_sass_hex_color_upper_case = false +ij_sass_keep_blank_lines_in_code = 2 +ij_sass_keep_indents_on_empty_lines = false +ij_sass_keep_single_line_blocks = false +ij_sass_line_comment_add_space = false +ij_sass_line_comment_at_first_column = false +ij_sass_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_sass_space_after_colon = true +ij_sass_space_before_opening_brace = true +ij_sass_use_double_quotes = true +ij_sass_value_alignment = 0 + +[*.scss] +indent_size = 2 +ij_scss_align_closing_brace_with_properties = false +ij_scss_blank_lines_around_nested_selector = 1 +ij_scss_blank_lines_between_blocks = 1 +ij_scss_block_comment_add_space = false +ij_scss_brace_placement = 0 +ij_scss_enforce_quotes_on_format = false +ij_scss_hex_color_long_format = false +ij_scss_hex_color_lower_case = false +ij_scss_hex_color_short_format = false +ij_scss_hex_color_upper_case = false +ij_scss_keep_blank_lines_in_code = 2 +ij_scss_keep_indents_on_empty_lines = false +ij_scss_keep_single_line_blocks = false +ij_scss_line_comment_add_space = false +ij_scss_line_comment_at_first_column = false +ij_scss_properties_order = font, font-family, font-size, font-weight, font-style, font-variant, font-size-adjust, font-stretch, line-height, position, z-index, top, right, bottom, left, display, visibility, float, clear, overflow, overflow-x, overflow-y, clip, zoom, align-content, align-items, align-self, flex, flex-flow, flex-basis, flex-direction, flex-grow, flex-shrink, flex-wrap, justify-content, order, box-sizing, width, min-width, max-width, height, min-height, max-height, margin, margin-top, margin-right, margin-bottom, margin-left, padding, padding-top, padding-right, padding-bottom, padding-left, table-layout, empty-cells, caption-side, border-spacing, border-collapse, list-style, list-style-position, list-style-type, list-style-image, content, quotes, counter-reset, counter-increment, resize, cursor, user-select, nav-index, nav-up, nav-right, nav-down, nav-left, transition, transition-delay, transition-timing-function, transition-duration, transition-property, transform, transform-origin, animation, animation-name, animation-duration, animation-play-state, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, text-align, text-align-last, vertical-align, white-space, text-decoration, text-emphasis, text-emphasis-color, text-emphasis-style, text-emphasis-position, text-indent, text-justify, letter-spacing, word-spacing, text-outline, text-transform, text-wrap, text-overflow, text-overflow-ellipsis, text-overflow-mode, word-wrap, word-break, tab-size, hyphens, pointer-events, opacity, color, border, border-width, border-style, border-color, border-top, border-top-width, border-top-style, border-top-color, border-right, border-right-width, border-right-style, border-right-color, border-bottom, border-bottom-width, border-bottom-style, border-bottom-color, border-left, border-left-width, border-left-style, border-left-color, border-radius, border-top-left-radius, border-top-right-radius, border-bottom-right-radius, border-bottom-left-radius, border-image, border-image-source, border-image-slice, border-image-width, border-image-outset, border-image-repeat, outline, outline-width, outline-style, outline-color, outline-offset, background, background-color, background-image, background-repeat, background-attachment, background-position, background-position-x, background-position-y, background-clip, background-origin, background-size, box-decoration-break, box-shadow, text-shadow +ij_scss_space_after_colon = true +ij_scss_space_before_opening_brace = true +ij_scss_use_double_quotes = true +ij_scss_value_alignment = 0 + +[{*.ats,*.cts,*.mts,*.ts}] +ij_continuation_indent_size = 4 +ij_typescript_align_imports = false +ij_typescript_align_multiline_array_initializer_expression = false +ij_typescript_align_multiline_binary_operation = false +ij_typescript_align_multiline_chained_methods = false +ij_typescript_align_multiline_extends_list = false +ij_typescript_align_multiline_for = true +ij_typescript_align_multiline_parameters = true +ij_typescript_align_multiline_parameters_in_calls = false +ij_typescript_align_multiline_ternary_operation = false +ij_typescript_align_object_properties = 0 +ij_typescript_align_union_types = false +ij_typescript_align_var_statements = 0 +ij_typescript_array_initializer_new_line_after_left_brace = false +ij_typescript_array_initializer_right_brace_on_new_line = false +ij_typescript_array_initializer_wrap = off +ij_typescript_assignment_wrap = off +ij_typescript_binary_operation_sign_on_next_line = false +ij_typescript_binary_operation_wrap = off +ij_typescript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_typescript_blank_lines_after_imports = 1 +ij_typescript_blank_lines_around_class = 1 +ij_typescript_blank_lines_around_field = 0 +ij_typescript_blank_lines_around_field_in_interface = 0 +ij_typescript_blank_lines_around_function = 1 +ij_typescript_blank_lines_around_method = 1 +ij_typescript_blank_lines_around_method_in_interface = 1 +ij_typescript_block_brace_style = end_of_line +ij_typescript_block_comment_add_space = false +ij_typescript_block_comment_at_first_column = true +ij_typescript_call_parameters_new_line_after_left_paren = false +ij_typescript_call_parameters_right_paren_on_new_line = false +ij_typescript_call_parameters_wrap = off +ij_typescript_catch_on_new_line = false +ij_typescript_chained_call_dot_on_new_line = true +ij_typescript_class_brace_style = end_of_line +ij_typescript_comma_on_new_line = false +ij_typescript_do_while_brace_force = never +ij_typescript_else_on_new_line = false +ij_typescript_enforce_trailing_comma = keep +ij_typescript_enum_constants_wrap = on_every_item +ij_typescript_extends_keyword_wrap = off +ij_typescript_extends_list_wrap = off +ij_typescript_field_prefix = _ +ij_typescript_file_name_style = relaxed +ij_typescript_finally_on_new_line = false +ij_typescript_for_brace_force = never +ij_typescript_for_statement_new_line_after_left_paren = false +ij_typescript_for_statement_right_paren_on_new_line = false +ij_typescript_for_statement_wrap = off +ij_typescript_force_quote_style = false +ij_typescript_force_semicolon_style = false +ij_typescript_function_expression_brace_style = end_of_line +ij_typescript_if_brace_force = never +ij_typescript_import_merge_members = global +ij_typescript_import_prefer_absolute_path = global +ij_typescript_import_sort_members = true +ij_typescript_import_sort_module_name = false +ij_typescript_import_use_node_resolution = true +ij_typescript_imports_wrap = on_every_item +ij_typescript_indent_case_from_switch = true +ij_typescript_indent_chained_calls = true +ij_typescript_indent_package_children = 0 +ij_typescript_jsdoc_include_types = false +ij_typescript_jsx_attribute_value = braces +ij_typescript_keep_blank_lines_in_code = 2 +ij_typescript_keep_first_column_comment = true +ij_typescript_keep_indents_on_empty_lines = false +ij_typescript_keep_line_breaks = true +ij_typescript_keep_simple_blocks_in_one_line = false +ij_typescript_keep_simple_methods_in_one_line = false +ij_typescript_line_comment_add_space = true +ij_typescript_line_comment_at_first_column = false +ij_typescript_method_brace_style = end_of_line +ij_typescript_method_call_chain_wrap = off +ij_typescript_method_parameters_new_line_after_left_paren = false +ij_typescript_method_parameters_right_paren_on_new_line = false +ij_typescript_method_parameters_wrap = off +ij_typescript_object_literal_wrap = on_every_item +ij_typescript_object_types_wrap = on_every_item +ij_typescript_parentheses_expression_new_line_after_left_paren = false +ij_typescript_parentheses_expression_right_paren_on_new_line = false +ij_typescript_place_assignment_sign_on_next_line = false +ij_typescript_prefer_as_type_cast = false +ij_typescript_prefer_explicit_types_function_expression_returns = false +ij_typescript_prefer_explicit_types_function_returns = false +ij_typescript_prefer_explicit_types_vars_fields = false +ij_typescript_prefer_parameters_wrap = false +ij_typescript_reformat_c_style_comments = false +ij_typescript_space_after_colon = true +ij_typescript_space_after_comma = true +ij_typescript_space_after_dots_in_rest_parameter = false +ij_typescript_space_after_generator_mult = true +ij_typescript_space_after_property_colon = true +ij_typescript_space_after_quest = true +ij_typescript_space_after_type_colon = true +ij_typescript_space_after_unary_not = false +ij_typescript_space_before_async_arrow_lparen = true +ij_typescript_space_before_catch_keyword = true +ij_typescript_space_before_catch_left_brace = true +ij_typescript_space_before_catch_parentheses = true +ij_typescript_space_before_class_lbrace = true +ij_typescript_space_before_class_left_brace = true +ij_typescript_space_before_colon = true +ij_typescript_space_before_comma = false +ij_typescript_space_before_do_left_brace = true +ij_typescript_space_before_else_keyword = true +ij_typescript_space_before_else_left_brace = true +ij_typescript_space_before_finally_keyword = true +ij_typescript_space_before_finally_left_brace = true +ij_typescript_space_before_for_left_brace = true +ij_typescript_space_before_for_parentheses = true +ij_typescript_space_before_for_semicolon = false +ij_typescript_space_before_function_left_parenth = true +ij_typescript_space_before_generator_mult = false +ij_typescript_space_before_if_left_brace = true +ij_typescript_space_before_if_parentheses = true +ij_typescript_space_before_method_call_parentheses = false +ij_typescript_space_before_method_left_brace = true +ij_typescript_space_before_method_parentheses = false +ij_typescript_space_before_property_colon = false +ij_typescript_space_before_quest = true +ij_typescript_space_before_switch_left_brace = true +ij_typescript_space_before_switch_parentheses = true +ij_typescript_space_before_try_left_brace = true +ij_typescript_space_before_type_colon = false +ij_typescript_space_before_unary_not = false +ij_typescript_space_before_while_keyword = true +ij_typescript_space_before_while_left_brace = true +ij_typescript_space_before_while_parentheses = true +ij_typescript_spaces_around_additive_operators = true +ij_typescript_spaces_around_arrow_function_operator = true +ij_typescript_spaces_around_assignment_operators = true +ij_typescript_spaces_around_bitwise_operators = true +ij_typescript_spaces_around_equality_operators = true +ij_typescript_spaces_around_logical_operators = true +ij_typescript_spaces_around_multiplicative_operators = true +ij_typescript_spaces_around_relational_operators = true +ij_typescript_spaces_around_shift_operators = true +ij_typescript_spaces_around_unary_operator = false +ij_typescript_spaces_within_array_initializer_brackets = false +ij_typescript_spaces_within_brackets = false +ij_typescript_spaces_within_catch_parentheses = false +ij_typescript_spaces_within_for_parentheses = false +ij_typescript_spaces_within_if_parentheses = false +ij_typescript_spaces_within_imports = false +ij_typescript_spaces_within_interpolation_expressions = false +ij_typescript_spaces_within_method_call_parentheses = false +ij_typescript_spaces_within_method_parentheses = false +ij_typescript_spaces_within_object_literal_braces = false +ij_typescript_spaces_within_object_type_braces = true +ij_typescript_spaces_within_parentheses = false +ij_typescript_spaces_within_switch_parentheses = false +ij_typescript_spaces_within_type_assertion = false +ij_typescript_spaces_within_union_types = true +ij_typescript_spaces_within_while_parentheses = false +ij_typescript_special_else_if_treatment = true +ij_typescript_ternary_operation_signs_on_next_line = false +ij_typescript_ternary_operation_wrap = off +ij_typescript_union_types_wrap = on_every_item +ij_typescript_use_chained_calls_group_indents = false +ij_typescript_use_double_quotes = true +ij_typescript_use_explicit_js_extension = auto +ij_typescript_use_path_mapping = always +ij_typescript_use_public_modifier = false +ij_typescript_use_semicolon_after_statement = true +ij_typescript_var_declaration_wrap = normal +ij_typescript_while_brace_force = never +ij_typescript_while_on_new_line = false +ij_typescript_wrap_comments = false + +[{*.cjs,*.js}] +ij_continuation_indent_size = 4 +ij_javascript_align_imports = false +ij_javascript_align_multiline_array_initializer_expression = false +ij_javascript_align_multiline_binary_operation = false +ij_javascript_align_multiline_chained_methods = false +ij_javascript_align_multiline_extends_list = false +ij_javascript_align_multiline_for = true +ij_javascript_align_multiline_parameters = true +ij_javascript_align_multiline_parameters_in_calls = false +ij_javascript_align_multiline_ternary_operation = false +ij_javascript_align_object_properties = 0 +ij_javascript_align_union_types = false +ij_javascript_align_var_statements = 0 +ij_javascript_array_initializer_new_line_after_left_brace = false +ij_javascript_array_initializer_right_brace_on_new_line = false +ij_javascript_array_initializer_wrap = off +ij_javascript_assignment_wrap = off +ij_javascript_binary_operation_sign_on_next_line = false +ij_javascript_binary_operation_wrap = off +ij_javascript_blacklist_imports = rxjs/Rx, node_modules/**, **/node_modules/**, @angular/material, @angular/material/typings/** +ij_javascript_blank_lines_after_imports = 1 +ij_javascript_blank_lines_around_class = 1 +ij_javascript_blank_lines_around_field = 0 +ij_javascript_blank_lines_around_function = 1 +ij_javascript_blank_lines_around_method = 1 +ij_javascript_block_brace_style = end_of_line +ij_javascript_block_comment_add_space = false +ij_javascript_block_comment_at_first_column = true +ij_javascript_call_parameters_new_line_after_left_paren = false +ij_javascript_call_parameters_right_paren_on_new_line = false +ij_javascript_call_parameters_wrap = off +ij_javascript_catch_on_new_line = false +ij_javascript_chained_call_dot_on_new_line = true +ij_javascript_class_brace_style = end_of_line +ij_javascript_comma_on_new_line = false +ij_javascript_do_while_brace_force = never +ij_javascript_else_on_new_line = false +ij_javascript_enforce_trailing_comma = keep +ij_javascript_extends_keyword_wrap = off +ij_javascript_extends_list_wrap = off +ij_javascript_field_prefix = _ +ij_javascript_file_name_style = relaxed +ij_javascript_finally_on_new_line = false +ij_javascript_for_brace_force = never +ij_javascript_for_statement_new_line_after_left_paren = false +ij_javascript_for_statement_right_paren_on_new_line = false +ij_javascript_for_statement_wrap = off +ij_javascript_force_quote_style = false +ij_javascript_force_semicolon_style = false +ij_javascript_function_expression_brace_style = end_of_line +ij_javascript_if_brace_force = never +ij_javascript_import_merge_members = global +ij_javascript_import_prefer_absolute_path = global +ij_javascript_import_sort_members = true +ij_javascript_import_sort_module_name = false +ij_javascript_import_use_node_resolution = true +ij_javascript_imports_wrap = on_every_item +ij_javascript_indent_case_from_switch = true +ij_javascript_indent_chained_calls = true +ij_javascript_indent_package_children = 0 +ij_javascript_jsx_attribute_value = braces +ij_javascript_keep_blank_lines_in_code = 2 +ij_javascript_keep_first_column_comment = true +ij_javascript_keep_indents_on_empty_lines = false +ij_javascript_keep_line_breaks = true +ij_javascript_keep_simple_blocks_in_one_line = false +ij_javascript_keep_simple_methods_in_one_line = false +ij_javascript_line_comment_add_space = true +ij_javascript_line_comment_at_first_column = false +ij_javascript_method_brace_style = end_of_line +ij_javascript_method_call_chain_wrap = off +ij_javascript_method_parameters_new_line_after_left_paren = false +ij_javascript_method_parameters_right_paren_on_new_line = false +ij_javascript_method_parameters_wrap = off +ij_javascript_object_literal_wrap = on_every_item +ij_javascript_object_types_wrap = on_every_item +ij_javascript_parentheses_expression_new_line_after_left_paren = false +ij_javascript_parentheses_expression_right_paren_on_new_line = false +ij_javascript_place_assignment_sign_on_next_line = false +ij_javascript_prefer_as_type_cast = false +ij_javascript_prefer_explicit_types_function_expression_returns = false +ij_javascript_prefer_explicit_types_function_returns = false +ij_javascript_prefer_explicit_types_vars_fields = false +ij_javascript_prefer_parameters_wrap = false +ij_javascript_reformat_c_style_comments = false +ij_javascript_space_after_colon = true +ij_javascript_space_after_comma = true +ij_javascript_space_after_dots_in_rest_parameter = false +ij_javascript_space_after_generator_mult = true +ij_javascript_space_after_property_colon = true +ij_javascript_space_after_quest = true +ij_javascript_space_after_type_colon = true +ij_javascript_space_after_unary_not = false +ij_javascript_space_before_async_arrow_lparen = true +ij_javascript_space_before_catch_keyword = true +ij_javascript_space_before_catch_left_brace = true +ij_javascript_space_before_catch_parentheses = true +ij_javascript_space_before_class_lbrace = true +ij_javascript_space_before_class_left_brace = true +ij_javascript_space_before_colon = true +ij_javascript_space_before_comma = false +ij_javascript_space_before_do_left_brace = true +ij_javascript_space_before_else_keyword = true +ij_javascript_space_before_else_left_brace = true +ij_javascript_space_before_finally_keyword = true +ij_javascript_space_before_finally_left_brace = true +ij_javascript_space_before_for_left_brace = true +ij_javascript_space_before_for_parentheses = true +ij_javascript_space_before_for_semicolon = false +ij_javascript_space_before_function_left_parenth = true +ij_javascript_space_before_generator_mult = false +ij_javascript_space_before_if_left_brace = true +ij_javascript_space_before_if_parentheses = true +ij_javascript_space_before_method_call_parentheses = false +ij_javascript_space_before_method_left_brace = true +ij_javascript_space_before_method_parentheses = false +ij_javascript_space_before_property_colon = false +ij_javascript_space_before_quest = true +ij_javascript_space_before_switch_left_brace = true +ij_javascript_space_before_switch_parentheses = true +ij_javascript_space_before_try_left_brace = true +ij_javascript_space_before_type_colon = false +ij_javascript_space_before_unary_not = false +ij_javascript_space_before_while_keyword = true +ij_javascript_space_before_while_left_brace = true +ij_javascript_space_before_while_parentheses = true +ij_javascript_spaces_around_additive_operators = true +ij_javascript_spaces_around_arrow_function_operator = true +ij_javascript_spaces_around_assignment_operators = true +ij_javascript_spaces_around_bitwise_operators = true +ij_javascript_spaces_around_equality_operators = true +ij_javascript_spaces_around_logical_operators = true +ij_javascript_spaces_around_multiplicative_operators = true +ij_javascript_spaces_around_relational_operators = true +ij_javascript_spaces_around_shift_operators = true +ij_javascript_spaces_around_unary_operator = false +ij_javascript_spaces_within_array_initializer_brackets = false +ij_javascript_spaces_within_brackets = false +ij_javascript_spaces_within_catch_parentheses = false +ij_javascript_spaces_within_for_parentheses = false +ij_javascript_spaces_within_if_parentheses = false +ij_javascript_spaces_within_imports = false +ij_javascript_spaces_within_interpolation_expressions = false +ij_javascript_spaces_within_method_call_parentheses = false +ij_javascript_spaces_within_method_parentheses = false +ij_javascript_spaces_within_object_literal_braces = false +ij_javascript_spaces_within_object_type_braces = true +ij_javascript_spaces_within_parentheses = false +ij_javascript_spaces_within_switch_parentheses = false +ij_javascript_spaces_within_type_assertion = false +ij_javascript_spaces_within_union_types = true +ij_javascript_spaces_within_while_parentheses = false +ij_javascript_special_else_if_treatment = true +ij_javascript_ternary_operation_signs_on_next_line = false +ij_javascript_ternary_operation_wrap = off +ij_javascript_union_types_wrap = on_every_item +ij_javascript_use_chained_calls_group_indents = false +ij_javascript_use_double_quotes = true +ij_javascript_use_explicit_js_extension = auto +ij_javascript_use_path_mapping = always +ij_javascript_use_public_modifier = false +ij_javascript_use_semicolon_after_statement = true +ij_javascript_var_declaration_wrap = normal +ij_javascript_while_brace_force = never +ij_javascript_while_on_new_line = false +ij_javascript_wrap_comments = false + +[{*.har,*.jsb2,*.jsb3,*.json,.babelrc,.eslintrc,.prettierrc,.stylelintrc,bowerrc,jest.config}] +indent_size = 2 +ij_json_array_wrapping = split_into_lines +ij_json_keep_blank_lines_in_code = 0 +ij_json_keep_indents_on_empty_lines = false +ij_json_keep_line_breaks = true +ij_json_keep_trailing_comma = false +ij_json_object_wrapping = split_into_lines +ij_json_property_alignment = do_not_align +ij_json_space_after_colon = true +ij_json_space_after_comma = true +ij_json_space_before_colon = false +ij_json_space_before_comma = false +ij_json_spaces_within_braces = false +ij_json_spaces_within_brackets = false +ij_json_wrap_long_lines = false + +[{*.htm,*.html,*.ng,*.sht,*.shtm,*.shtml}] +ij_html_add_new_line_before_tags = body, div, p, form, h1, h2, h3 +ij_html_align_attributes = true +ij_html_align_text = false +ij_html_attribute_wrap = normal +ij_html_block_comment_add_space = false +ij_html_block_comment_at_first_column = true +ij_html_do_not_align_children_of_min_lines = 0 +ij_html_do_not_break_if_inline_tags = title, h1, h2, h3, h4, h5, h6, p +ij_html_do_not_indent_children_of_tags = html, body, thead, tbody, tfoot +ij_html_enforce_quotes = false +ij_html_inline_tags = a, abbr, acronym, b, basefont, bdo, big, br, cite, cite, code, dfn, em, font, i, img, input, kbd, label, q, s, samp, select, small, span, strike, strong, sub, sup, textarea, tt, u, var +ij_html_keep_blank_lines = 2 +ij_html_keep_indents_on_empty_lines = false +ij_html_keep_line_breaks = true +ij_html_keep_line_breaks_in_text = true +ij_html_keep_whitespaces = false +ij_html_keep_whitespaces_inside = span, pre, textarea +ij_html_line_comment_at_first_column = true +ij_html_new_line_after_last_attribute = never +ij_html_new_line_before_first_attribute = never +ij_html_quote_style = double +ij_html_remove_new_line_before_tags = br +ij_html_space_after_tag_name = false +ij_html_space_around_equality_in_attribute = false +ij_html_space_inside_empty_tag = false +ij_html_text_wrap = normal + +[{*.markdown,*.md}] +ij_markdown_force_one_space_after_blockquote_symbol = true +ij_markdown_force_one_space_after_header_symbol = true +ij_markdown_force_one_space_after_list_bullet = true +ij_markdown_force_one_space_between_words = true +ij_markdown_format_tables = true +ij_markdown_insert_quote_arrows_on_wrap = true +ij_markdown_keep_indents_on_empty_lines = false +ij_markdown_keep_line_breaks_inside_text_blocks = true +ij_markdown_max_lines_around_block_elements = 1 +ij_markdown_max_lines_around_header = 1 +ij_markdown_max_lines_between_paragraphs = 1 +ij_markdown_min_lines_around_block_elements = 1 +ij_markdown_min_lines_around_header = 1 +ij_markdown_min_lines_between_paragraphs = 1 +ij_markdown_wrap_text_if_long = true +ij_markdown_wrap_text_inside_blockquotes = true diff --git a/.gitignore b/.gitignore index e9618a3..4e572ed 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules .next -.env.local \ No newline at end of file +.env.local +.idea \ No newline at end of file diff --git a/README.md b/README.md index 500a317..20bc2ee 100644 --- a/README.md +++ b/README.md @@ -1,17 +1,18 @@ # loan-facilities-user - - ## Getting started To make it easy for you to get started with GitLab, here's a list of recommended next steps. -Already a pro? Just edit this README.md and make it your own. Want to make it easy? [Use the template at the bottom](#editing-this-readme)! +Already a pro? Just edit this README.md and make it your own. Want to make it +easy? [Use the template at the bottom](#editing-this-readme)! ## Add your files -- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files -- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) or push an existing Git repository with the following command: +- [ ] [Create](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#create-a-file) + or [upload](https://docs.gitlab.com/ee/user/project/repository/web_editor.html#upload-a-file) files +- [ ] [Add files using the command line](https://docs.gitlab.com/ee/gitlab-basics/add-file.html#add-a-file-using-the-command-line) + or push an existing Git repository with the following command: ``` cd existing_repo @@ -46,47 +47,82 @@ Use the built-in continuous integration in GitLab. # Editing this README -When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to structure it however you want - this is just a starting point!). Thank you to [makeareadme.com](https://www.makeareadme.com/) for this template. +When you're ready to make this README your own, just edit this file and use the handy template below (or feel free to +structure it however you want - this is just a starting point!). Thank you +to [makeareadme.com](https://www.makeareadme.com/) for this template. ## Suggestions for a good README -Every project is different, so consider which of these sections apply to yours. The sections used in the template are suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long is better than too short. If you think your README is too long, consider utilizing another form of documentation rather than cutting out information. + +Every project is different, so consider which of these sections apply to yours. The sections used in the template are +suggestions for most open source projects. Also keep in mind that while a README can be too long and detailed, too long +is better than too short. If you think your README is too long, consider utilizing another form of documentation rather +than cutting out information. ## Name + Choose a self-explaining name for your project. ## Description -Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your project, this is a good place to list differentiating factors. + +Let people know what your project can do specifically. Provide context and add a link to any reference visitors might be +unfamiliar with. A list of Features or a Background subsection can also be added here. If there are alternatives to your +project, this is a good place to list differentiating factors. ## Badges -On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. + +On some READMEs, you may see small images that convey metadata, such as whether or not all the tests are passing for the +project. You can use Shields to add some to your README. Many services also have instructions for adding a badge. ## Visuals -Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. + +Depending on what you are making, it can be a good idea to include screenshots or even a video (you'll frequently see +GIFs rather than actual videos). Tools like ttygif can help, but check out Asciinema for a more sophisticated method. ## Installation -Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a specific context like a particular programming language version or operating system or has dependencies that have to be installed manually, also add a Requirements subsection. + +Within a particular ecosystem, there may be a common way of installing things, such as using Yarn, NuGet, or Homebrew. +However, consider the possibility that whoever is reading your README is a novice and would like more guidance. Listing +specific steps helps remove ambiguity and gets people to using your project as quickly as possible. If it only runs in a +specific context like a particular programming language version or operating system or has dependencies that have to be +installed manually, also add a Requirements subsection. ## Usage -Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably include in the README. + +Use examples liberally, and show the expected output if you can. It's helpful to have inline the smallest example of +usage that you can demonstrate, while providing links to more sophisticated examples if they are too long to reasonably +include in the README. ## Support -Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, etc. + +Tell people where they can go to for help. It can be any combination of an issue tracker, a chat room, an email address, +etc. ## Roadmap + If you have ideas for releases in the future, it is a good idea to list them in the README. ## Contributing + State if you are open to contributions and what your requirements are for accepting them. -For people who want to make changes to your project, it's helpful to have some documentation on how to get started. Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps explicit. These instructions could also be useful to your future self. +For people who want to make changes to your project, it's helpful to have some documentation on how to get started. +Perhaps there is a script that they should run or some environment variables that they need to set. Make these steps +explicit. These instructions could also be useful to your future self. -You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce the likelihood that the changes inadvertently break something. Having instructions for running tests is especially helpful if it requires external setup, such as starting a Selenium server for testing in a browser. +You can also document commands to lint the code or run tests. These steps help to ensure high code quality and reduce +the likelihood that the changes inadvertently break something. Having instructions for running tests is especially +helpful if it requires external setup, such as starting a Selenium server for testing in a browser. ## Authors and acknowledgment + Show your appreciation to those who have contributed to the project. ## License + For open source projects, say how it is licensed. ## Project status -If you have run out of energy or time for your project, put a note at the top of the README saying that development has slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or owner, allowing your project to keep going. You can also make an explicit request for maintainers. + +If you have run out of energy or time for your project, put a note at the top of the README saying that development has +slowed down or stopped completely. Someone may choose to fork your project or volunteer to step in as a maintainer or +owner, allowing your project to keep going. You can also make an explicit request for maintainers. diff --git a/jsconfig.json b/jsconfig.json index f6a30b1..fcd02aa 100644 --- a/jsconfig.json +++ b/jsconfig.json @@ -1,8 +1,12 @@ { "compilerOptions": { "paths": { - "@/*": ["./src/*"], - "&/*": ["./public/*"], + "@/*": [ + "./src/*" + ], + "&/*": [ + "./public/*" + ] } } } diff --git a/next.config.js b/next.config.js index 03fb527..409876a 100644 --- a/next.config.js +++ b/next.config.js @@ -1,12 +1,12 @@ /** @type {import('next').NextConfig} */ const nextConfig = { - reactStrictMode: true, - i18n: { - defaultLocale: 'fa', - locales: ['fa'], - localeDetection: false, - }, + reactStrictMode: true, + i18n: { + defaultLocale: 'fa', + locales: ['fa'], + localeDetection: false, + }, } module.exports = nextConfig diff --git a/public/fontiran.scss b/public/fontiran.scss index e263b42..ffa1438 100644 --- a/public/fontiran.scss +++ b/public/fontiran.scss @@ -17,80 +17,87 @@ This set of fonts are used in this project under the license: (.....) * **/ @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: 900; - src: url('./fonts/eot/IRANSansWeb_Black.eot'); - src: url('./fonts/eot/IRANSansWeb_Black.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb_Black.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb_Black.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb_Black.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: 900; + src: url('./fonts/eot/IRANSansWeb_Black.eot'); + src: url('./fonts/eot/IRANSansWeb_Black.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb_Black.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb_Black.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb_Black.ttf') format('truetype'); } + @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: bold; - src: url('./fonts/eot/IRANSansWeb_Bold.eot'); - src: url('./fonts/eot/IRANSansWeb_Bold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb_Bold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb_Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb_Bold.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: bold; + src: url('./fonts/eot/IRANSansWeb_Bold.eot'); + src: url('./fonts/eot/IRANSansWeb_Bold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb_Bold.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb_Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb_Bold.ttf') format('truetype'); } + @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: 500; - src: url('./fonts/eot/IRANSansWeb_Medium.eot'); - src: url('./fonts/eot/IRANSansWeb_Medium.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb_Medium.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb_Medium.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb_Medium.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: 500; + src: url('./fonts/eot/IRANSansWeb_Medium.eot'); + src: url('./fonts/eot/IRANSansWeb_Medium.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb_Medium.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb_Medium.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb_Medium.ttf') format('truetype'); } + @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: 300; - src: url('./fonts/eot/IRANSansWeb_Light.eot'); - src: url('./fonts/eot/IRANSansWeb_Light.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb_Light.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb_Light.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb_Light.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: 300; + src: url('./fonts/eot/IRANSansWeb_Light.eot'); + src: url('./fonts/eot/IRANSansWeb_Light.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb_Light.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb_Light.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb_Light.ttf') format('truetype'); } + @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: 200; - src: url('./fonts/eot/IRANSansWeb_UltraLight.eot'); - src: url('./fonts/eot/IRANSansWeb_UltraLight.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb_UltraLight.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb_UltraLight.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb_UltraLight.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: 200; + src: url('./fonts/eot/IRANSansWeb_UltraLight.eot'); + src: url('./fonts/eot/IRANSansWeb_UltraLight.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb_UltraLight.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb_UltraLight.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb_UltraLight.ttf') format('truetype'); } + @font-face { - font-family: IRANSans; - font-style: normal; - font-weight: normal; - src: url('./fonts/eot/IRANSansWeb.eot'); - src: url('./fonts/eot/IRANSansWeb.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff2/IRANSansWeb.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ - url('./fonts/woff/IRANSansWeb.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/IRANSansWeb.ttf') format('truetype'); + font-family: IRANSans; + font-style: normal; + font-weight: normal; + src: url('./fonts/eot/IRANSansWeb.eot'); + src: url('./fonts/eot/IRANSansWeb.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff2/IRANSansWeb.woff2') format('woff2'), /* FF39+,Chrome36+, Opera24+*/ + url('./fonts/woff/IRANSansWeb.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/IRANSansWeb.ttf') format('truetype'); } + @font-face { - font-family: Parastoo; - font-style: normal; - font-weight: normal; - src: url('./fonts/eot/Parastoo.eot'); - src: url('./fonts/eot/Parastoo.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff/Parastoo.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/Parastoo.ttf') format('truetype'); + font-family: Parastoo; + font-style: normal; + font-weight: normal; + src: url('./fonts/eot/Parastoo.eot'); + src: url('./fonts/eot/Parastoo.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff/Parastoo.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/Parastoo.ttf') format('truetype'); } + @font-face { - font-family: Parastoo; - font-style: normal; - font-weight: bold; - src: url('./fonts/eot/Parastoo-Bold.eot'); - src: url('./fonts/eot/Parastoo-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ - url('./fonts/woff/Parastoo-Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ - url('./fonts/ttf/Parastoo-Bold.ttf') format('truetype'); + font-family: Parastoo; + font-style: normal; + font-weight: bold; + src: url('./fonts/eot/Parastoo-Bold.eot'); + src: url('./fonts/eot/Parastoo-Bold.eot?#iefix') format('embedded-opentype'), /* IE6-8 */ + url('./fonts/woff/Parastoo-Bold.woff') format('woff'), /* FF3.6+, IE9, Chrome6+, Saf5.1+*/ + url('./fonts/ttf/Parastoo-Bold.ttf') format('truetype'); } diff --git a/public/images/change-password.svg b/public/images/change-password.svg index f3b65aa..d940442 100644 --- a/public/images/change-password.svg +++ b/public/images/change-password.svg @@ -1 +1,64 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/dashboard.svg b/public/images/dashboard.svg index ea3f11b..f7c0340 100644 --- a/public/images/dashboard.svg +++ b/public/images/dashboard.svg @@ -1 +1,104 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/loading.svg b/public/images/loading.svg index 03b8908..f2fc10e 100644 --- a/public/images/loading.svg +++ b/public/images/loading.svg @@ -1 +1,42 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/login.svg b/public/images/login.svg index e2854d2..cd7e24e 100644 --- a/public/images/login.svg +++ b/public/images/login.svg @@ -1 +1,60 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/not-found.svg b/public/images/not-found.svg index 8735cf8..b233cca 100644 --- a/public/images/not-found.svg +++ b/public/images/not-found.svg @@ -1 +1,90 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/register.svg b/public/images/register.svg index f5184c9..6424756 100644 --- a/public/images/register.svg +++ b/public/images/register.svg @@ -1 +1,86 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/images/upload-image.svg b/public/images/upload-image.svg index 3bbca65..c901145 100644 --- a/public/images/upload-image.svg +++ b/public/images/upload-image.svg @@ -1 +1,92 @@ - \ No newline at end of file + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/public/locales/fa/datatable.js b/public/locales/fa/datatable.js index e42208f..7713862 100644 --- a/public/locales/fa/datatable.js +++ b/public/locales/fa/datatable.js @@ -1,92 +1,92 @@ export const FA_DATATABLE_LOCALIZATION = { - actions: "Actions", - and: "and", - cancel: "Cancel", - changeFilterMode: "Change filter mode", - changeSearchMode: "Change search mode", - clearFilter: "Clear filter", - clearSearch: "Clear search", - clearSort: "Clear sort", - clickToCopy: "Click to copy", - collapse: "Collapse", - collapseAll: "Collapse all", - columnActions: "Column Actions", - copiedToClipboard: "Copied to clipboard", - dropToGroupBy: "Drop to group by {column}", - edit: "Edit", - expand: "Expand", - expandAll: "Expand all", - filterArrIncludes: "Includes", - filterArrIncludesAll: "Includes all", - filterArrIncludesSome: "Includes", - filterBetween: "Between", - filterBetweenInclusive: "Between Inclusive", - filterByColumn: "Filter by {column}", - filterContains: "Contains", - filterEmpty: "Empty", - filterEndsWith: "Ends With", - filterEquals: "Equals", - filterEqualsString: "Equals", - filterFuzzy: "Fuzzy", - filterGreaterThan: "Greater Than", - filterGreaterThanOrEqualTo: "Greater Than Or Equal To", - filterInNumberRange: "Between", - filterIncludesString: "Contains", - filterIncludesStringSensitive: "Contains", - filterLessThan: "Less Than", - filterLessThanOrEqualTo: "Less Than Or Equal To", - filterMode: "Filter Mode: {filterType}", - filterNotEmpty: "Not Empty", - filterNotEquals: "Not Equals", - filterStartsWith: "Starts With", - filterWeakEquals: "Equals", - filteringByColumn: "Filtering by {column} - {filterType} {filterValue}", - goToFirstPage: "Go to first page", - goToLastPage: "Go to last page", - goToNextPage: "Go to next page", - goToPreviousPage: "Go to previous page", - grab: "Grab", - groupByColumn: "Group by {column}", - groupedBy: "Grouped by ", - hideAll: "Hide all", - hideColumn: "Hide {column} column", - max: "Max", - min: "Min", - move: "Move", - noRecordsToDisplay: "No records to display", - noResultsFound: "No results found", - of: "of", - or: "or", - pinToLeft: "Pin to left", - pinToRight: "Pin to right", - resetColumnSize: "Reset column size", - resetOrder: "Reset order", - rowActions: "Row Actions", - rowNumber: "#", - rowNumbers: "Row Numbers", - rowsPerPage: "Rows per page", - save: "Save", - search: "Search", - selectedCountOfRowCountRowsSelected: - "{selectedCount} of {rowCount} row(s) selected", - select: "Select", - showAll: "Show all", - showAllColumns: "Show all columns", - showHideColumns: "Show/Hide columns", - showHideFilters: "Show/Hide filters", - showHideSearch: "Show/Hide search", - sortByColumnAsc: "Sort by {column} ascending", - sortByColumnDesc: "Sort by {column} descending", - sortedByColumnAsc: "Sorted by {column} ascending", - sortedByColumnDesc: "Sorted by {column} descending", - thenBy: ", then by ", - toggleDensity: "Toggle density", - toggleFullScreen: "Toggle full screen", - toggleSelectAll: "Toggle select all", - toggleSelectRow: "Toggle select row", - toggleVisibility: "Toggle visibility", - ungroupByColumn: "Ungroup by {column}", - unpin: "Unpin", - unpinAll: "Unpin all", - unsorted: "Unsorted", + actions: "Actions", + and: "and", + cancel: "Cancel", + changeFilterMode: "Change filter mode", + changeSearchMode: "Change search mode", + clearFilter: "Clear filter", + clearSearch: "Clear search", + clearSort: "Clear sort", + clickToCopy: "Click to copy", + collapse: "Collapse", + collapseAll: "Collapse all", + columnActions: "Column Actions", + copiedToClipboard: "Copied to clipboard", + dropToGroupBy: "Drop to group by {column}", + edit: "Edit", + expand: "Expand", + expandAll: "Expand all", + filterArrIncludes: "Includes", + filterArrIncludesAll: "Includes all", + filterArrIncludesSome: "Includes", + filterBetween: "Between", + filterBetweenInclusive: "Between Inclusive", + filterByColumn: "Filter by {column}", + filterContains: "Contains", + filterEmpty: "Empty", + filterEndsWith: "Ends With", + filterEquals: "Equals", + filterEqualsString: "Equals", + filterFuzzy: "Fuzzy", + filterGreaterThan: "Greater Than", + filterGreaterThanOrEqualTo: "Greater Than Or Equal To", + filterInNumberRange: "Between", + filterIncludesString: "Contains", + filterIncludesStringSensitive: "Contains", + filterLessThan: "Less Than", + filterLessThanOrEqualTo: "Less Than Or Equal To", + filterMode: "Filter Mode: {filterType}", + filterNotEmpty: "Not Empty", + filterNotEquals: "Not Equals", + filterStartsWith: "Starts With", + filterWeakEquals: "Equals", + filteringByColumn: "Filtering by {column} - {filterType} {filterValue}", + goToFirstPage: "Go to first page", + goToLastPage: "Go to last page", + goToNextPage: "Go to next page", + goToPreviousPage: "Go to previous page", + grab: "Grab", + groupByColumn: "Group by {column}", + groupedBy: "Grouped by ", + hideAll: "Hide all", + hideColumn: "Hide {column} column", + max: "Max", + min: "Min", + move: "Move", + noRecordsToDisplay: "No records to display", + noResultsFound: "No results found", + of: "of", + or: "or", + pinToLeft: "Pin to left", + pinToRight: "Pin to right", + resetColumnSize: "Reset column size", + resetOrder: "Reset order", + rowActions: "Row Actions", + rowNumber: "#", + rowNumbers: "Row Numbers", + rowsPerPage: "Rows per page", + save: "Save", + search: "Search", + selectedCountOfRowCountRowsSelected: + "{selectedCount} of {rowCount} row(s) selected", + select: "Select", + showAll: "Show all", + showAllColumns: "Show all columns", + showHideColumns: "Show/Hide columns", + showHideFilters: "Show/Hide filters", + showHideSearch: "Show/Hide search", + sortByColumnAsc: "Sort by {column} ascending", + sortByColumnDesc: "Sort by {column} descending", + sortedByColumnAsc: "Sorted by {column} ascending", + sortedByColumnDesc: "Sorted by {column} descending", + thenBy: ", then by ", + toggleDensity: "Toggle density", + toggleFullScreen: "Toggle full screen", + toggleSelectAll: "Toggle select all", + toggleSelectRow: "Toggle select row", + toggleVisibility: "Toggle visibility", + ungroupByColumn: "Ungroup by {column}", + unpin: "Unpin", + unpinAll: "Unpin all", + unsorted: "Unsorted", }; diff --git a/src/components/dashboard/first/index.jsx b/src/components/dashboard/first/index.jsx index c693380..ee4f80a 100644 --- a/src/components/dashboard/first/index.jsx +++ b/src/components/dashboard/first/index.jsx @@ -1,7 +1,7 @@ import DashboardLayouts from "@/layouts/dashboardLayouts"; const DashboardFirstComponent = () => { - return ; + return ; }; export default DashboardFirstComponent; diff --git a/src/components/dashboard/loan-follow-up/index.jsx b/src/components/dashboard/loan-follow-up/index.jsx index 1b211af..5284cb4 100644 --- a/src/components/dashboard/loan-follow-up/index.jsx +++ b/src/components/dashboard/loan-follow-up/index.jsx @@ -2,121 +2,122 @@ import DashboardLayouts from "@/layouts/dashboardLayouts"; import useUser from "@/lib/app/hooks/useUser"; import ExpandMoreIcon from "@mui/icons-material/ExpandMore"; import { - Avatar, Card, - CardActions, - CardContent, - CardHeader, - Collapse, - Grid, - IconButton, - Stack, - Typography + Avatar, + Card, + CardActions, + CardContent, + CardHeader, + Collapse, + Grid, + IconButton, + Stack, + Typography } from "@mui/material"; -import { styled } from "@mui/material/styles"; -import { useTranslations } from "next-intl"; -import { useState } from "react"; +import {styled} from "@mui/material/styles"; +import {useTranslations} from "next-intl"; +import {useState} from "react"; const ExpandMore = styled((props) => { - const { expand, ...other } = props; - return ; -})(({ theme, expand }) => ({ - transform: !expand ? "rotate(0deg)" : "rotate(180deg)", - marginLeft: "auto", - transition: theme.transitions.create("transform", { - duration: theme.transitions.duration.shortest, - }), + const {expand, ...other} = props; + return ; +})(({theme, expand}) => ({ + transform: !expand ? "rotate(0deg)" : "rotate(180deg)", + marginLeft: "auto", + transition: theme.transitions.create("transform", { + duration: theme.transitions.duration.shortest, + }), })); const data = [ - { - name: "جان دو", - date: "۱۳۹۹/۰۴/۲۵", - description: - "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است.", - }, - { - name: "جین اسمیت", - date: "۱۳۹۹/۰۴/۲۶", - description: "نُلا ویته الیت لیبرو آ، آ فارِترا آوگوه.", - }, - { - name: "مایک جانسون", - date: "۱۳۹۹/۰۴/۲۷", - description: - "دوئیس مولیس، است نُن کُمُدو لُکتوس، نیسی ارات پورتیتور لیگولا.", - }, + { + name: "جان دو", + date: "۱۳۹۹/۰۴/۲۵", + description: + "لورم ایپسوم متن ساختگی با تولید سادگی نامفهوم از صنعت چاپ و با استفاده از طراحان گرافیک است.", + }, + { + name: "جین اسمیت", + date: "۱۳۹۹/۰۴/۲۶", + description: "نُلا ویته الیت لیبرو آ، آ فارِترا آوگوه.", + }, + { + name: "مایک جانسون", + date: "۱۳۹۹/۰۴/۲۷", + description: + "دوئیس مولیس، است نُن کُمُدو لُکتوس، نیسی ارات پورتیتور لیگولا.", + }, ]; const DashboardLoanFollowUpComponent = () => { - const t = useTranslations(); - const { token } = useUser(); + const t = useTranslations(); + const {token} = useUser(); - const [expanded, setExpanded] = useState([]); + const [expanded, setExpanded] = useState([]); - const handleExpandClick = (index) => { - setExpanded((prevExpanded) => { - const newExpanded = [...prevExpanded]; - newExpanded[index] = !newExpanded[index]; - return newExpanded; - }); - }; + const handleExpandClick = (index) => { + setExpanded((prevExpanded) => { + const newExpanded = [...prevExpanded]; + newExpanded[index] = !newExpanded[index]; + return newExpanded; + }); + }; - return ( - - - - {data.map((item, index) => ( - - - - } - title={item.name} - subheader={item.date} - /> - - - متن تست - - - - handleExpandClick(index)} - aria-expanded={expanded[index]} - aria-label="show more" - > - - - - - - اطلاعات تکمیلی: - {item.description} - - - - - ))} - - - - ); + return ( + + + + {data.map((item, index) => ( + + + + } + title={item.name} + subheader={item.date} + /> + + + متن تست + + + + handleExpandClick(index)} + aria-expanded={expanded[index]} + aria-label="show more" + > + + + + + + اطلاعات تکمیلی: + {item.description} + + + + + ))} + + + + ); }; export default DashboardLoanFollowUpComponent; diff --git a/src/components/dashboard/loan-request/NavyForm.jsx b/src/components/dashboard/loan-request/NavyForm.jsx index 9e7c40c..dfe9327 100644 --- a/src/components/dashboard/loan-request/NavyForm.jsx +++ b/src/components/dashboard/loan-request/NavyForm.jsx @@ -2,490 +2,487 @@ import Notifications from "@/core/components/notifications"; import SelectBox from "@/core/components/SelectBox"; import StyledForm from "@/core/components/StyledForm"; import UploadSystem from "@/core/components/UploadSystem"; -import { - GET_PROVINCE_LIST, - SEND_LOAN_REQUEST_NAVGAN, -} from "@/core/data/apiRoutes"; +import {GET_PROVINCE_LIST, SEND_LOAN_REQUEST_NAVGAN,} from "@/core/data/apiRoutes"; import useDirection from "@/lib/app/hooks/useDirection"; import useUser from "@/lib/app/hooks/useUser"; import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; -import { Box, Button, Stack, TextField } from "@mui/material"; +import {Box, Button, Stack, TextField} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; -import { useEffect, useState } from "react"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; +import {useEffect, useState} from "react"; import * as Yup from "yup"; const NavyForm = () => { - const t = useTranslations(); - const { directionApp } = useDirection(); - const { token } = useUser(); + const t = useTranslations(); + const {directionApp} = useDirection(); + const {token} = useUser(); - // get province list - const [provinceList, setProvinceList] = useState([]); - useEffect(() => { - axios - .get(GET_PROVINCE_LIST, { - headers: { Authorization: `Bearer ${token}` }, - }) - .then(({ data }) => { - const formattedData = data.map((province, index) => ({ - id: index, - name: province.name, - value: province.id, - })); - setProvinceList(formattedData); - }) - .catch((error) => { - Notifications(directionApp, t, error.response); - }); - }, []); - // end get province list + // get province list + const [provinceList, setProvinceList] = useState([]); + useEffect(() => { + axios + .get(GET_PROVINCE_LIST, { + headers: {Authorization: `Bearer ${token}`}, + }) + .then(({data}) => { + const formattedData = data.map((province, index) => ({ + id: index, + name: province.name, + value: province.id, + })); + setProvinceList(formattedData); + }) + .catch((error) => { + Notifications(directionApp, t, error.response); + }); + }, []); + // end get province list - // upload files - const [selectedImageShenasname, setSelectedImageShenasname] = useState( - "/images/upload-image.svg" - ); - const [fileTypeShenasname, setFileTypeShenasname] = useState(null); - const [fileNameShenasname, setFileNameShenasname] = useState(null); - const [selectedImageNationalCard, setSelectedImageNationalCard] = useState( - "/images/upload-image.svg" - ); - const [fileTypeNationalCard, setFileTypeNationalCard] = useState(null); - const [fileNameNationalCard, setFileNameNationalCard] = useState(null); + // upload files + const [selectedImageShenasname, setSelectedImageShenasname] = useState( + "/images/upload-image.svg" + ); + const [fileTypeShenasname, setFileTypeShenasname] = useState(null); + const [fileNameShenasname, setFileNameShenasname] = useState(null); + const [selectedImageNationalCard, setSelectedImageNationalCard] = useState( + "/images/upload-image.svg" + ); + const [fileTypeNationalCard, setFileTypeNationalCard] = useState(null); + const [fileNameNationalCard, setFileNameNationalCard] = useState(null); - const handleUploadChangeShenasname = (event, setFieldValue) => { - const uploadedFile = event.target?.files?.[0]; - if (uploadedFile) { - const fileType = event.target?.files?.[0].type; - const fileName = event.target?.files?.[0].name; - setSelectedImageShenasname(URL.createObjectURL(uploadedFile)); - setFileTypeShenasname(fileType); - setFileNameShenasname(fileName); - setFieldValue("shenasname_img", uploadedFile); - } - }; - const handleUploadChangeNationalCard = (event, setFieldValue) => { - const uploadedFile = event.target?.files?.[0]; - const fileType = event.target.files[0].type; - const fileName = event.target.files[0].name; - if (uploadedFile) { - setSelectedImageNationalCard(URL.createObjectURL(uploadedFile)); - setFileTypeNationalCard(fileType); - setFileNameNationalCard(fileName); - setFieldValue("national_card_img", uploadedFile); - } - }; - // end upload files + const handleUploadChangeShenasname = (event, setFieldValue) => { + const uploadedFile = event.target?.files?.[0]; + if (uploadedFile) { + const fileType = event.target?.files?.[0].type; + const fileName = event.target?.files?.[0].name; + setSelectedImageShenasname(URL.createObjectURL(uploadedFile)); + setFileTypeShenasname(fileType); + setFileNameShenasname(fileName); + setFieldValue("shenasname_img", uploadedFile); + } + }; + const handleUploadChangeNationalCard = (event, setFieldValue) => { + const uploadedFile = event.target?.files?.[0]; + const fileType = event.target.files[0].type; + const fileName = event.target.files[0].name; + if (uploadedFile) { + setSelectedImageNationalCard(URL.createObjectURL(uploadedFile)); + setFileTypeNationalCard(fileType); + setFileNameNationalCard(fileName); + setFieldValue("national_card_img", uploadedFile); + } + }; + // end upload files - // initial values - const initialValues = { - name: "", - phone_number: "", - vehicle_type: "", - plate_number: "", - province: "", - navgan_id: "", - national_code: "", - shenasname_id: "", - national_card_img: null, - shenasname_img: null, - }; - // end initial values + // initial values + const initialValues = { + name: "", + phone_number: "", + vehicle_type: "", + plate_number: "", + province: "", + navgan_id: "", + national_code: "", + shenasname_id: "", + national_card_img: null, + shenasname_img: null, + }; + // end initial values - // validation - const validationSchema = Yup.object().shape({ - name: Yup.string().required(t("LoanRequest.error_message_required")), - phone_number: Yup.string().required( - t("LoanRequest.error_message_required") - ), - vehicle_type: Yup.string().required( - t("LoanRequest.error_message_required") - ), - plate_number: Yup.string().required( - t("LoanRequest.error_message_required") - ), - navgan_id: Yup.string().required(t("LoanRequest.error_message_required")), - province: Yup.string().required(t("LoanRequest.error_message_required")), - national_code: Yup.string().required( - t("LoanRequest.error_message_required") - ), - shenasname_id: Yup.string().required( - t("LoanRequest.error_message_required") - ), - }); - // end validation + // validation + const validationSchema = Yup.object().shape({ + name: Yup.string().required(t("LoanRequest.error_message_required")), + phone_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + vehicle_type: Yup.string().required( + t("LoanRequest.error_message_required") + ), + plate_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + navgan_id: Yup.string().required(t("LoanRequest.error_message_required")), + province: Yup.string().required(t("LoanRequest.error_message_required")), + national_code: Yup.string().required( + t("LoanRequest.error_message_required") + ), + shenasname_id: Yup.string().required( + t("LoanRequest.error_message_required") + ), + }); + // end validation - // submit - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - const formData = new FormData(); - formData.append("name", values.name); - formData.append("phone_number", values.phone_number); - formData.append("vehicle_type", values.vehicle_type); - formData.append("plate_number", values.plate_number); - formData.append("province_id", values.province); - formData.append("navgan_id", values.navgan_id); - formData.append("national_code", values.national_code); - formData.append("shenasname_id", values.shenasname_id); - if (values.shenasname_img != null) - formData.append("shenasname_image", values.shenasname_img); - if (values.national_card_img != null) - formData.append("national_card_image", values.national_card_img); + // submit + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + const formData = new FormData(); + formData.append("name", values.name); + formData.append("phone_number", values.phone_number); + formData.append("vehicle_type", values.vehicle_type); + formData.append("plate_number", values.plate_number); + formData.append("province_id", values.province); + formData.append("navgan_id", values.navgan_id); + formData.append("national_code", values.national_code); + formData.append("shenasname_id", values.shenasname_id); + if (values.shenasname_img != null) + formData.append("shenasname_image", values.shenasname_img); + if (values.national_card_img != null) + formData.append("national_card_image", values.national_card_img); - await axios - .post(SEND_LOAN_REQUEST_NAVGAN, formData, { - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "multipart/form-data", - }, - }) - .then(function (response) { - Notifications(directionApp, t, response); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; - // end submit + await axios + .post(SEND_LOAN_REQUEST_NAVGAN, formData, { + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "multipart/form-data", + }, + }) + .then(function (response) { + Notifications(directionApp, t, response); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; + // end submit - return ( - - {(props) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - handleUploadChangeShenasname(e, props.setFieldValue) - } - setselectedImage={setSelectedImageShenasname} - setFieldValue={props.setFieldValue} - fieldname="shenasname_img" - fileType={fileTypeShenasname} - fileName={fileNameShenasname} - imageAlt={t("app_name")} - imageSize={[300 /*width*/, 150 /*height*/]} - label={t("LoanRequest.file_field_shenasname_image")} - /> - - handleUploadChangeNationalCard(e, props.setFieldValue) - } - setselectedImage={setSelectedImageNationalCard} - setFieldValue={props.setFieldValue} - fieldname="national_card_img" - fileType={fileTypeNationalCard} - fileName={fileNameNationalCard} - imageAlt={t("app_name")} - imageSize={[300 /*width*/, 150 /*height*/]} - label={t("LoanRequest.file_field_national_card_image")} - /> - - - - - - - )} - - ); + {(props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + handleUploadChangeShenasname(e, props.setFieldValue) + } + setselectedImage={setSelectedImageShenasname} + setFieldValue={props.setFieldValue} + fieldname="shenasname_img" + fileType={fileTypeShenasname} + fileName={fileNameShenasname} + imageAlt={t("app_name")} + imageSize={[300 /*width*/, 150 /*height*/]} + label={t("LoanRequest.file_field_shenasname_image")} + /> + + handleUploadChangeNationalCard(e, props.setFieldValue) + } + setselectedImage={setSelectedImageNationalCard} + setFieldValue={props.setFieldValue} + fieldname="national_card_img" + fileType={fileTypeNationalCard} + fileName={fileNameNationalCard} + imageAlt={t("app_name")} + imageSize={[300 /*width*/, 150 /*height*/]} + label={t("LoanRequest.file_field_national_card_image")} + /> + + + + + + + )} + + ); }; export default NavyForm; diff --git a/src/components/dashboard/loan-request/WelfareServicesForm.jsx b/src/components/dashboard/loan-request/WelfareServicesForm.jsx index 73759bc..6a50ef7 100644 --- a/src/components/dashboard/loan-request/WelfareServicesForm.jsx +++ b/src/components/dashboard/loan-request/WelfareServicesForm.jsx @@ -1,435 +1,435 @@ import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; import UploadSystem from "@/core/components/UploadSystem"; -import { SEND_LOAN_REQUEST_WELFARE } from "@/core/data/apiRoutes"; +import {SEND_LOAN_REQUEST_WELFARE} from "@/core/data/apiRoutes"; import useDirection from "@/lib/app/hooks/useDirection"; import useUser from "@/lib/app/hooks/useUser"; import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; -import { Box, Button, Stack, TextField } from "@mui/material"; +import {Box, Button, Stack, TextField} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; -import { useState } from "react"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; +import {useState} from "react"; import * as Yup from "yup"; const WelfareServicesForm = () => { - const t = useTranslations(); - const { directionApp } = useDirection(); - const { token } = useUser(); + const t = useTranslations(); + const {directionApp} = useDirection(); + const {token} = useUser(); - // upload files - const [selectedImageShenasname, setSelectedImageShenasname] = useState( - "/images/upload-image.svg" - ); - const [fileTypeShenasname, setFileTypeShenasname] = useState(null); - const [fileNameShenasname, setFileNameShenasname] = useState(null); - const [selectedImageNationalCard, setSelectedImageNationalCard] = useState( - "/images/upload-image.svg" - ); - const [fileTypeNationalCard, setFileTypeNationalCard] = useState(null); - const [fileNameNationalCard, setFileNameNationalCard] = useState(null); + // upload files + const [selectedImageShenasname, setSelectedImageShenasname] = useState( + "/images/upload-image.svg" + ); + const [fileTypeShenasname, setFileTypeShenasname] = useState(null); + const [fileNameShenasname, setFileNameShenasname] = useState(null); + const [selectedImageNationalCard, setSelectedImageNationalCard] = useState( + "/images/upload-image.svg" + ); + const [fileTypeNationalCard, setFileTypeNationalCard] = useState(null); + const [fileNameNationalCard, setFileNameNationalCard] = useState(null); - const handleUploadChangeShenasname = (event, setFieldValue) => { - const uploadedFile = event.target?.files?.[0]; - if (uploadedFile) { - const fileType = event.target?.files?.[0].type; - const fileName = event.target?.files?.[0].name; - setSelectedImageShenasname(URL.createObjectURL(uploadedFile)); - setFileTypeShenasname(fileType); - setFileNameShenasname(fileName); - setFieldValue("shenasname_img", uploadedFile); - } - }; - const handleUploadChangeNationalCard = (event, setFieldValue) => { - const uploadedFile = event.target?.files?.[0]; - const fileType = event.target.files[0].type; - const fileName = event.target.files[0].name; - if (uploadedFile) { - setSelectedImageNationalCard(URL.createObjectURL(uploadedFile)); - setFileTypeNationalCard(fileType); - setFileNameNationalCard(fileName); - setFieldValue("national_card_img", uploadedFile); - } - }; - // end upload files + const handleUploadChangeShenasname = (event, setFieldValue) => { + const uploadedFile = event.target?.files?.[0]; + if (uploadedFile) { + const fileType = event.target?.files?.[0].type; + const fileName = event.target?.files?.[0].name; + setSelectedImageShenasname(URL.createObjectURL(uploadedFile)); + setFileTypeShenasname(fileType); + setFileNameShenasname(fileName); + setFieldValue("shenasname_img", uploadedFile); + } + }; + const handleUploadChangeNationalCard = (event, setFieldValue) => { + const uploadedFile = event.target?.files?.[0]; + const fileType = event.target.files[0].type; + const fileName = event.target.files[0].name; + if (uploadedFile) { + setSelectedImageNationalCard(URL.createObjectURL(uploadedFile)); + setFileTypeNationalCard(fileType); + setFileNameNationalCard(fileName); + setFieldValue("national_card_img", uploadedFile); + } + }; + // end upload files - // initial values, validation and request action of form - const initialValues = { - name: "", - phone_number: "", - vehicle_type: "", - plate_number: "", - province: "", - national_code: "", - shenasname_id: "", - national_card_img: null, - shenasname_img: null, - }; + // initial values, validation and request action of form + const initialValues = { + name: "", + phone_number: "", + vehicle_type: "", + plate_number: "", + province: "", + national_code: "", + shenasname_id: "", + national_card_img: null, + shenasname_img: null, + }; - const validationSchema = Yup.object().shape({ - name: Yup.string().required(t("LoanRequest.error_message_required")), - phone_number: Yup.string().required( - t("LoanRequest.error_message_required") - ), - vehicle_type: Yup.string().required( - t("LoanRequest.error_message_required") - ), - plate_number: Yup.string().required( - t("LoanRequest.error_message_required") - ), - province: Yup.string().required(t("LoanRequest.error_message_required")), - national_code: Yup.string().required( - t("LoanRequest.error_message_required") - ), - shenasname_id: Yup.string().required( - t("LoanRequest.error_message_required") - ), - }); + const validationSchema = Yup.object().shape({ + name: Yup.string().required(t("LoanRequest.error_message_required")), + phone_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + vehicle_type: Yup.string().required( + t("LoanRequest.error_message_required") + ), + plate_number: Yup.string().required( + t("LoanRequest.error_message_required") + ), + province: Yup.string().required(t("LoanRequest.error_message_required")), + national_code: Yup.string().required( + t("LoanRequest.error_message_required") + ), + shenasname_id: Yup.string().required( + t("LoanRequest.error_message_required") + ), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - const formData = new FormData(); - formData.append("name", values.name); - formData.append("phone_number", values.phone_number); - formData.append("vehicle_type", values.vehicle_type); - formData.append("plate_number", values.plate_number); - formData.append("province_id", values.province); - formData.append("national_code", values.national_code); - formData.append("shenasname_id", values.shenasname_id); - if (values.shenasname_img != null) - formData.append("shenasname_image", values.shenasname_img); - if (values.national_card_img != null) - formData.append("national_card_image", values.national_card_img); + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + const formData = new FormData(); + formData.append("name", values.name); + formData.append("phone_number", values.phone_number); + formData.append("vehicle_type", values.vehicle_type); + formData.append("plate_number", values.plate_number); + formData.append("province_id", values.province); + formData.append("national_code", values.national_code); + formData.append("shenasname_id", values.shenasname_id); + if (values.shenasname_img != null) + formData.append("shenasname_image", values.shenasname_img); + if (values.national_card_img != null) + formData.append("national_card_image", values.national_card_img); - await axios - .post(SEND_LOAN_REQUEST_WELFARE, formData, { - headers: { - Authorization: `Bearer ${token}`, - "Content-Type": "multipart/form-data", - }, - }) - .then(function (response) { - Notifications(directionApp, t, response); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; - // end initial values, validation and request action of form + await axios + .post(SEND_LOAN_REQUEST_WELFARE, formData, { + headers: { + Authorization: `Bearer ${token}`, + "Content-Type": "multipart/form-data", + }, + }) + .then(function (response) { + Notifications(directionApp, t, response); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; + // end initial values, validation and request action of form - return ( - - {(props) => ( - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - handleUploadChangeShenasname(e, props.setFieldValue) - } - setselectedImage={setSelectedImageShenasname} - setFieldValue={props.setFieldValue} - fieldname="shenasname_img" - fileType={fileTypeShenasname} - fileName={fileNameShenasname} - imageAlt={t("app_name")} - imageSize={[300 /*width*/, 150 /*height*/]} - label={t("LoanRequest.file_field_shenasname_image")} - /> - - handleUploadChangeNationalCard(e, props.setFieldValue) - } - setselectedImage={setSelectedImageNationalCard} - setFieldValue={props.setFieldValue} - fieldname="national_card_img" - fileType={fileTypeNationalCard} - fileName={fileNameNationalCard} - imageAlt={t("app_name")} - imageSize={[300 /*width*/, 150 /*height*/]} - label={t("LoanRequest.file_field_national_card_image")} - /> - - - - - - - )} - - ); + {(props) => ( + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + handleUploadChangeShenasname(e, props.setFieldValue) + } + setselectedImage={setSelectedImageShenasname} + setFieldValue={props.setFieldValue} + fieldname="shenasname_img" + fileType={fileTypeShenasname} + fileName={fileNameShenasname} + imageAlt={t("app_name")} + imageSize={[300 /*width*/, 150 /*height*/]} + label={t("LoanRequest.file_field_shenasname_image")} + /> + + handleUploadChangeNationalCard(e, props.setFieldValue) + } + setselectedImage={setSelectedImageNationalCard} + setFieldValue={props.setFieldValue} + fieldname="national_card_img" + fileType={fileTypeNationalCard} + fileName={fileNameNationalCard} + imageAlt={t("app_name")} + imageSize={[300 /*width*/, 150 /*height*/]} + label={t("LoanRequest.file_field_national_card_image")} + /> + + + + + + + )} + + ); }; export default WelfareServicesForm; diff --git a/src/components/dashboard/loan-request/index.jsx b/src/components/dashboard/loan-request/index.jsx index 3b5d31f..630642a 100644 --- a/src/components/dashboard/loan-request/index.jsx +++ b/src/components/dashboard/loan-request/index.jsx @@ -3,29 +3,29 @@ import DashboardLayouts from "@/layouts/dashboardLayouts"; import useUser from "@/lib/app/hooks/useUser"; import NavyForm from "./NavyForm"; import WelfareServicesForm from "./WelfareServicesForm"; -import { Divider, Chip, Box } from "@mui/material"; -import { useTranslations } from "next-intl"; +import {Box, Chip, Divider} from "@mui/material"; +import {useTranslations} from "next-intl"; const DashboardLoanRequestComponent = () => { - const t = useTranslations(); - const { user } = useUser(); + const t = useTranslations(); + const {user} = useUser(); - return ( - - - - - - - - {user.type_id == 1 ? : } - - - ); + return ( + + + + + + + + {user.type_id == 1 ? : } + + + ); }; export default DashboardLoanRequestComponent; diff --git a/src/components/first/index.jsx b/src/components/first/index.jsx index 1436752..67f6284 100644 --- a/src/components/first/index.jsx +++ b/src/components/first/index.jsx @@ -1,55 +1,55 @@ import dahsboardImage from "&/images/dashboard.svg"; -import { NextLinkComposed } from "@/core/components/LinkRouting"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; import StyledImage from "@/core/components/StyledImage"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useUser from "@/lib/app/hooks/useUser"; -import { Button, Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; +import {Button, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; const FirstComponent = () => { - const t = useTranslations(); - const { isAuth } = useUser(); + const t = useTranslations(); + const {isAuth} = useUser(); - return ( - - - - - {t("app_name")} - - {isAuth ? ( - - ) : ( - - )} - - - ); + return ( + + + + + {t("app_name")} + + {isAuth ? ( + + ) : ( + + )} + + + ); }; export default FirstComponent; diff --git a/src/components/login/SendToken.jsx b/src/components/login/SendToken.jsx index 6567084..8699aa4 100644 --- a/src/components/login/SendToken.jsx +++ b/src/components/login/SendToken.jsx @@ -1,167 +1,158 @@ import Notifications from "@/core/components/notifications"; import ResendToken from "@/core/components/ResendToken"; import StyledForm from "@/core/components/StyledForm"; -import { LOGIN } from "@/core/data/apiRoutes"; +import {LOGIN} from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import useUser from "@/lib/app/hooks/useUser"; import ChangeCircleIcon from "@mui/icons-material/ChangeCircle"; import LoginIcon from "@mui/icons-material/Login"; -import { - Box, - Button, - Container, - Grid, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; +import {Box, Button, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; import Image from "next/image"; import * as Yup from "yup"; const SendToken = ({ - PhoneNumber, - setOtpToken, - timer, - setTimer, - initialTimerValue, -}) => { - const t = useTranslations(); - const { directionApp } = useDirection(); - const { setToken } = useUser(); + PhoneNumber, + setOtpToken, + timer, + setTimer, + initialTimerValue, + }) => { + const t = useTranslations(); + const {directionApp} = useDirection(); + const {setToken} = useUser(); - const initialValues = { - phone_number: PhoneNumber, - verification_code: "", - }; - const validationSchema = Yup.object().shape({ - verification_code: Yup.string().required( - t("LoginPage.error_message_required") - ), - }); + const initialValues = { + phone_number: PhoneNumber, + verification_code: "", + }; + const validationSchema = Yup.object().shape({ + verification_code: Yup.string().required( + t("LoginPage.error_message_required") + ), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - await axios - .post(LOGIN, { - phone_number: values.phone_number, - verification_code: values.verification_code, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setToken(response.data.token); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + await axios + .post(LOGIN, { + phone_number: values.phone_number, + verification_code: values.verification_code, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setToken(response.data.token); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; - return ( - - - - - - {(props) => ( - - - {t("app_name")} - - - {t("login")} - - - - - - {t("LoginPage.sent_token_to")}: {PhoneNumber} - - - - - - - - - - - - - - )} - - - - - - ); + {(props) => ( + + + {t("app_name")} + + + {t("login")} + + + + + + {t("LoginPage.sent_token_to")}: {PhoneNumber} + + + + + + + + + + + + + + )} + + + + + + ); }; export default SendToken; diff --git a/src/components/login/SendUserData.jsx b/src/components/login/SendUserData.jsx index bb14087..8b4b056 100644 --- a/src/components/login/SendUserData.jsx +++ b/src/components/login/SendUserData.jsx @@ -1,173 +1,164 @@ import LinkRouting from "@/core/components/LinkRouting"; import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; -import { SEND_OTP_TOKEN } from "@/core/data/apiRoutes"; +import {SEND_OTP_TOKEN} from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import FingerprintIcon from "@mui/icons-material/Fingerprint"; import PersonAddIcon from "@mui/icons-material/PersonAdd"; -import { - Box, - Button, - Container, - Grid, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; +import {Box, Button, Container, Grid, Paper, Stack, TextField, Typography,} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; import Image from "next/image"; -import { useSearchParams } from "next/navigation"; +import {useSearchParams} from "next/navigation"; import * as Yup from "yup"; const SendUserData = ({ - setOtpToken, - setPhoneNumber, - PhoneNumber, - setTimer, - initialTimerValue, -}) => { - const t = useTranslations(); - const { directionApp } = useDirection(); + setOtpToken, + setPhoneNumber, + PhoneNumber, + setTimer, + initialTimerValue, + }) => { + const t = useTranslations(); + const {directionApp} = useDirection(); - const searchParams = useSearchParams(); - const backUrlDecodedPath = searchParams.get("back_url"); + const searchParams = useSearchParams(); + const backUrlDecodedPath = searchParams.get("back_url"); - const initialValues = { - phone_number: PhoneNumber, - }; - const validationSchema = Yup.object().shape({ - phone_number: Yup.string().required(t("LoginPage.error_message_required")), - }); + const initialValues = { + phone_number: PhoneNumber, + }; + const validationSchema = Yup.object().shape({ + phone_number: Yup.string().required(t("LoginPage.error_message_required")), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - await axios - .post(SEND_OTP_TOKEN, { - phone_number: values.phone_number, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setPhoneNumber(values.phone_number); - setOtpToken(true); - setTimer(initialTimerValue); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + await axios + .post(SEND_OTP_TOKEN, { + phone_number: values.phone_number, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setPhoneNumber(values.phone_number); + setOtpToken(true); + setTimer(initialTimerValue); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; - return ( - - - - - - {(props) => ( - - - {t("app_name")} - - - {t("Titles.title_login_page")} - - - - - - - - - - - - - - - - - - )} - - - - - - - {t("LoginPage.link_routing_back_to")}{" "} - {backUrlDecodedPath - ? t("LoginPage.link_routing_previuos_page") - : t("LoginPage.link_routing_main_page")} - - - - ); + return ( + + + + + + {(props) => ( + + + {t("app_name")} + + + {t("Titles.title_login_page")} + + + + + + + + + + + + + + + + + + )} + + + + + + + {t("LoginPage.link_routing_back_to")}{" "} + {backUrlDecodedPath + ? t("LoginPage.link_routing_previuos_page") + : t("LoginPage.link_routing_main_page")} + + + + ); }; export default SendUserData; diff --git a/src/components/login/index.jsx b/src/components/login/index.jsx index fe20a4d..1d90474 100644 --- a/src/components/login/index.jsx +++ b/src/components/login/index.jsx @@ -1,37 +1,37 @@ -import { useState } from "react"; +import {useState} from "react"; import SendToken from "./SendToken"; import SendUserData from "./SendUserData"; const LoginComponent = () => { - const [otpToken, setOtpToken] = useState(false); - const [PhoneNumber, setPhoneNumber] = useState(""); + const [otpToken, setOtpToken] = useState(false); + const [PhoneNumber, setPhoneNumber] = useState(""); - // For Resend Token (read ResendToken Component Doc) - const initialTimerValue = 30; - const [timer, setTimer] = useState(initialTimerValue); - // End For Resend Token + // For Resend Token (read ResendToken Component Doc) + const initialTimerValue = 30; + const [timer, setTimer] = useState(initialTimerValue); + // End For Resend Token - if (!otpToken) { - return ( - - ); - } else { - return ( - - ); - } + if (!otpToken) { + return ( + + ); + } else { + return ( + + ); + } }; export default LoginComponent; diff --git a/src/components/not-found.jsx b/src/components/not-found.jsx index c699d84..96f2863 100644 --- a/src/components/not-found.jsx +++ b/src/components/not-found.jsx @@ -1,38 +1,38 @@ import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; -import { Box, Button, Typography } from "@mui/material"; -import { NextLinkComposed } from "@/core/components/LinkRouting"; -import { useTranslations } from "next-intl"; +import {Box, Button, Typography} from "@mui/material"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; +import {useTranslations} from "next-intl"; import Image from "next/image"; const NotFoundComponent = () => { const t = useTranslations(); - return ( - - - - not found image - - - صفحه ای با این عنوان یافت نشد - - - - - ); + return ( + + + + not found image + + + صفحه ای با این عنوان یافت نشد + + + + + ); }; export default NotFoundComponent; diff --git a/src/components/register/RequestOtp.jsx b/src/components/register/RequestOtp.jsx index 3c209d9..88804f8 100644 --- a/src/components/register/RequestOtp.jsx +++ b/src/components/register/RequestOtp.jsx @@ -1,151 +1,143 @@ import LinkRouting from "@/core/components/LinkRouting"; import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; -import { SEND_OTP_TOKEN } from "@/core/data/apiRoutes"; +import {SEND_OTP_TOKEN} from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import FingerprintIcon from "@mui/icons-material/Fingerprint"; -import { - Box, - Button, - Container, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; +import {Box, Button, Container, Paper, Stack, TextField, Typography,} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; import Image from "next/image"; -import { useSearchParams } from "next/navigation"; +import {useSearchParams} from "next/navigation"; import * as Yup from "yup"; const RequestOtp = ({ - setOtpToken, - setPhoneNumber, - PhoneNumber, - setTimer, - initialTimerValue, -}) => { - const t = useTranslations(); - const { directionApp } = useDirection(); + setOtpToken, + setPhoneNumber, + PhoneNumber, + setTimer, + initialTimerValue, + }) => { + const t = useTranslations(); + const {directionApp} = useDirection(); - const searchParams = useSearchParams(); - const backUrlDecodedPath = searchParams.get("back_url"); + const searchParams = useSearchParams(); + const backUrlDecodedPath = searchParams.get("back_url"); - const initialValues = { - phone_number: PhoneNumber, - }; - const validationSchema = Yup.object().shape({ - phone_number: Yup.string().required( - t("RegisterPage.error_message_required") - ), - }); + const initialValues = { + phone_number: PhoneNumber, + }; + const validationSchema = Yup.object().shape({ + phone_number: Yup.string().required( + t("RegisterPage.error_message_required") + ), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - await axios - .post(SEND_OTP_TOKEN, { - phone_number: values.phone_number, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setPhoneNumber(values.phone_number); - setOtpToken(true); - setTimer(initialTimerValue); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + await axios + .post(SEND_OTP_TOKEN, { + phone_number: values.phone_number, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setPhoneNumber(values.phone_number); + setOtpToken(true); + setTimer(initialTimerValue); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; - return ( - - - - - - {(props) => ( - - - {t("app_name")} - - - {t("Titles.title_register_page")} - - - - - - - - - )} - - - - - - - {t("RegisterPage.link_routing_back_to")}{" "} - {backUrlDecodedPath - ? t("RegisterPage.link_routing_previuos_page") - : t("RegisterPage.link_routing_register")} - - - - ); + return ( + + + + + + {(props) => ( + + + {t("app_name")} + + + {t("Titles.title_register_page")} + + + + + + + + + )} + + + + + + + {t("RegisterPage.link_routing_back_to")}{" "} + {backUrlDecodedPath + ? t("RegisterPage.link_routing_previuos_page") + : t("RegisterPage.link_routing_register")} + + + + ); }; export default RequestOtp; diff --git a/src/components/register/index.jsx b/src/components/register/index.jsx index f71ba2a..6e05291 100644 --- a/src/components/register/index.jsx +++ b/src/components/register/index.jsx @@ -1,98 +1,97 @@ import dahsboardImage from "&/images/dashboard.svg"; -import LinkRouting from "@/core/components/LinkRouting"; -import { NextLinkComposed } from "@/core/components/LinkRouting"; +import LinkRouting, {NextLinkComposed} from "@/core/components/LinkRouting"; import StyledImage from "@/core/components/StyledImage"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useUser from "@/lib/app/hooks/useUser"; -import { Box, Button, Grid, Stack } from "@mui/material"; -import { useTranslations } from "next-intl"; -import { useSearchParams } from "next/navigation"; +import {Box, Button, Grid, Stack} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useSearchParams} from "next/navigation"; const RegisterComponent = () => { - const t = useTranslations(); - const { isAuth } = useUser(); + const t = useTranslations(); + const {isAuth} = useUser(); - const searchParams = useSearchParams(); - const backUrlDecodedPath = searchParams.get("back_url"); + const searchParams = useSearchParams(); + const backUrlDecodedPath = searchParams.get("back_url"); - return ( - - - - {isAuth ? ( - - ) : ( - - - - + ) : ( + + + + + + + + + + + )} + + + - {t("register_navy")} - - - - - - - - )} - - - - {t("RegisterPage.link_routing_back_to")}{" "} - {backUrlDecodedPath - ? t("RegisterPage.link_routing_previuos_page") - : t("RegisterPage.link_routing_login")} - - - - ); + {t("RegisterPage.link_routing_back_to")}{" "} + {backUrlDecodedPath + ? t("RegisterPage.link_routing_previuos_page") + : t("RegisterPage.link_routing_login")} + + + + ); }; export default RegisterComponent; diff --git a/src/components/register/navy/UserRegister.jsx b/src/components/register/navy/UserRegister.jsx index e9d618a..b7a50f9 100644 --- a/src/components/register/navy/UserRegister.jsx +++ b/src/components/register/navy/UserRegister.jsx @@ -1,222 +1,212 @@ import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; -import { REGISTER } from "@/core/data/apiRoutes"; +import {REGISTER} from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import LoginIcon from "@mui/icons-material/Login"; import ChangeCircleIcon from "@mui/icons-material/ChangeCircle"; -import { - Box, - Button, - Chip, - Container, - Divider, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; +import {Box, Button, Chip, Container, Divider, Paper, Stack, TextField, Typography,} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; import Image from "next/image"; import * as Yup from "yup"; import ResendToken from "@/core/components/ResendToken"; import useUser from "@/lib/app/hooks/useUser"; const UserRegister = ({ - PhoneNumber, - setOtpToken, - initialTimerValue, - timer, - setTimer, -}) => { - const t = useTranslations(); - const { directionApp } = useDirection(); - const { setToken } = useUser(); + PhoneNumber, + setOtpToken, + initialTimerValue, + timer, + setTimer, + }) => { + const t = useTranslations(); + const {directionApp} = useDirection(); + const {setToken} = useUser(); - const initialValues = { - type_id: "1", - verification_code: "", - phone_number: PhoneNumber, - national_id: "", - navgan_id: "", - }; + const initialValues = { + type_id: "1", + verification_code: "", + phone_number: PhoneNumber, + national_id: "", + navgan_id: "", + }; - const validationSchema = Yup.object().shape({ - verification_code: Yup.string().required( - t("RegisterPage.error_message_required") - ), - national_id: Yup.string().required( - t("RegisterPage.error_message_required") - ), - navgan_id: Yup.string().required(t("RegisterPage.error_message_required")), - }); + const validationSchema = Yup.object().shape({ + verification_code: Yup.string().required( + t("RegisterPage.error_message_required") + ), + national_id: Yup.string().required( + t("RegisterPage.error_message_required") + ), + navgan_id: Yup.string().required(t("RegisterPage.error_message_required")), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - console.log(initialValues); - await axios - .post(REGISTER, { - type_id: values.type_id, - national_id: values.national_id, - navgan_id: values.navgan_id, - phone_number: values.phone_number, - verification_code: values.verification_code, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setOtpToken(true); - setToken(response.data.token); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + console.log(initialValues); + await axios + .post(REGISTER, { + type_id: values.type_id, + national_id: values.national_id, + navgan_id: values.navgan_id, + phone_number: values.phone_number, + verification_code: values.verification_code, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setOtpToken(true); + setToken(response.data.token); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; - return ( - - - - - - {(props) => ( - - - {t("app_name")} - - - {t("register_navy")} - - - - - - {t("LoginPage.sent_token_to")}: {PhoneNumber} - - - - - - - - - - - - - - - )} - - - - - - ); + {(props) => ( + + + {t("app_name")} + + + {t("register_navy")} + + + + + + {t("LoginPage.sent_token_to")}: {PhoneNumber} + + + + + + + + + + + + + + + )} + + + + + + ); }; export default UserRegister; diff --git a/src/components/register/navy/index.jsx b/src/components/register/navy/index.jsx index f3c5938..68a6069 100644 --- a/src/components/register/navy/index.jsx +++ b/src/components/register/navy/index.jsx @@ -1,37 +1,37 @@ -import { useState } from "react"; +import {useState} from "react"; import RequestOtp from "../RequestOtp"; import UserRegister from "./UserRegister"; const NavyComponent = () => { - const [otpToken, setOtpToken] = useState(false); - const [PhoneNumber, setPhoneNumber] = useState(""); + const [otpToken, setOtpToken] = useState(false); + const [PhoneNumber, setPhoneNumber] = useState(""); - // For Resend Token (read ResendToken Component Doc) - const initialTimerValue = 30; - const [timer, setTimer] = useState(initialTimerValue); - // End For Resend Token + // For Resend Token (read ResendToken Component Doc) + const initialTimerValue = 30; + const [timer, setTimer] = useState(initialTimerValue); + // End For Resend Token - if (!otpToken) { - return ( - - ); - } else { - return ( - - ); - } + if (!otpToken) { + return ( + + ); + } else { + return ( + + ); + } }; export default NavyComponent; diff --git a/src/components/register/welfare-services/UserRegister.jsx b/src/components/register/welfare-services/UserRegister.jsx index c15db81..324c5c2 100644 --- a/src/components/register/welfare-services/UserRegister.jsx +++ b/src/components/register/welfare-services/UserRegister.jsx @@ -1,198 +1,188 @@ import Notifications from "@/core/components/notifications"; import StyledForm from "@/core/components/StyledForm"; -import { REGISTER } from "@/core/data/apiRoutes"; +import {REGISTER} from "@/core/data/apiRoutes"; import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import useDirection from "@/lib/app/hooks/useDirection"; import LoginIcon from "@mui/icons-material/Login"; import ChangeCircleIcon from "@mui/icons-material/ChangeCircle"; -import { - Box, - Button, - Chip, - Container, - Divider, - Paper, - Stack, - TextField, - Typography, -} from "@mui/material"; +import {Box, Button, Chip, Container, Divider, Paper, Stack, TextField, Typography,} from "@mui/material"; import axios from "axios"; -import { Field, Formik } from "formik"; -import { useTranslations } from "next-intl"; +import {Field, Formik} from "formik"; +import {useTranslations} from "next-intl"; import Image from "next/image"; import * as Yup from "yup"; import ResendToken from "@/core/components/ResendToken"; import useUser from "@/lib/app/hooks/useUser"; const UserRegister = ({ - PhoneNumber, - setOtpToken, - initialTimerValue, - timer, - setTimer, -}) => { - const t = useTranslations(); - const { directionApp } = useDirection(); - const { setToken } = useUser(); + PhoneNumber, + setOtpToken, + initialTimerValue, + timer, + setTimer, + }) => { + const t = useTranslations(); + const {directionApp} = useDirection(); + const {setToken} = useUser(); - const initialValues = { - type_id: "2", - verification_code: "", - phone_number: PhoneNumber, - national_id: "", - }; + const initialValues = { + type_id: "2", + verification_code: "", + phone_number: PhoneNumber, + national_id: "", + }; - const validationSchema = Yup.object().shape({ - verification_code: Yup.string().required( - t("RegisterPage.error_message_required") - ), - national_id: Yup.string().required( - t("RegisterPage.error_message_required") - ), - }); + const validationSchema = Yup.object().shape({ + verification_code: Yup.string().required( + t("RegisterPage.error_message_required") + ), + national_id: Yup.string().required( + t("RegisterPage.error_message_required") + ), + }); - const handleSubmit = async (values, props) => { - Notifications(directionApp, t, undefined); - console.log(initialValues); - await axios - .post(REGISTER, { - type_id: values.type_id, - national_id: values.national_id, - phone_number: values.phone_number, - verification_code: values.verification_code, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setOtpToken(true); - setToken(response.data.token); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - props.setSubmitting(false); - }); - }; + const handleSubmit = async (values, props) => { + Notifications(directionApp, t, undefined); + console.log(initialValues); + await axios + .post(REGISTER, { + type_id: values.type_id, + national_id: values.national_id, + phone_number: values.phone_number, + verification_code: values.verification_code, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setOtpToken(true); + setToken(response.data.token); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + props.setSubmitting(false); + }); + }; - return ( - - - - - - {(props) => ( - - - {t("app_name")} - - - {t("register_welfare_services")} - - - - - - {t("LoginPage.sent_token_to")}: {PhoneNumber} - - - - - - - - - - - - - - )} - - - - - - ); + {(props) => ( + + + {t("app_name")} + + + {t("register_welfare_services")} + + + + + + {t("LoginPage.sent_token_to")}: {PhoneNumber} + + + + + + + + + + + + + + )} + + + + + + ); }; export default UserRegister; diff --git a/src/components/register/welfare-services/index.jsx b/src/components/register/welfare-services/index.jsx index f3c5938..68a6069 100644 --- a/src/components/register/welfare-services/index.jsx +++ b/src/components/register/welfare-services/index.jsx @@ -1,37 +1,37 @@ -import { useState } from "react"; +import {useState} from "react"; import RequestOtp from "../RequestOtp"; import UserRegister from "./UserRegister"; const NavyComponent = () => { - const [otpToken, setOtpToken] = useState(false); - const [PhoneNumber, setPhoneNumber] = useState(""); + const [otpToken, setOtpToken] = useState(false); + const [PhoneNumber, setPhoneNumber] = useState(""); - // For Resend Token (read ResendToken Component Doc) - const initialTimerValue = 30; - const [timer, setTimer] = useState(initialTimerValue); - // End For Resend Token + // For Resend Token (read ResendToken Component Doc) + const initialTimerValue = 30; + const [timer, setTimer] = useState(initialTimerValue); + // End For Resend Token - if (!otpToken) { - return ( - - ); - } else { - return ( - - ); - } + if (!otpToken) { + return ( + + ); + } else { + return ( + + ); + } }; export default NavyComponent; diff --git a/src/core/components/LinkRouting.jsx b/src/core/components/LinkRouting.jsx index ff33c86..f8fac0a 100644 --- a/src/core/components/LinkRouting.jsx +++ b/src/core/components/LinkRouting.jsx @@ -1,116 +1,116 @@ import MuiLink from "@mui/material/Link"; -import { styled } from "@mui/material/styles"; +import {styled} from "@mui/material/styles"; import clsx from "clsx"; import NextLink from "next/link"; -import { useRouter } from "next/router"; +import {useRouter} from "next/router"; import * as React from "react"; // Add support for the sx prop for consistency with the other branches. const Anchor = styled("a")({}); export const NextLinkComposed = React.forwardRef(function NextLinkComposed( - props, - ref + props, + ref ) { - const { - to, - linkAs, - replace, - scroll, - shallow, - prefetch, - legacyBehavior = true, - locale, - ...other - } = props; + const { + to, + linkAs, + replace, + scroll, + shallow, + prefetch, + legacyBehavior = true, + locale, + ...other + } = props; - return ( - - - - ); + return ( + + + + ); }); // A styled version of the Next.js Link component: // https://nextjs.org/docs/api-reference/next/link const LinkRouting = React.forwardRef(function Link(props, ref) { - const { - activeClassName = "active", - as, - className: classNameProps, - href, - legacyBehavior, - linkAs: linkAsProp, - locale, - noLinkStyle, - prefetch, - replace, - role, // Link don't have roles. - scroll, - shallow, - ...other - } = props; + const { + activeClassName = "active", + as, + className: classNameProps, + href, + legacyBehavior, + linkAs: linkAsProp, + locale, + noLinkStyle, + prefetch, + replace, + role, // Link don't have roles. + scroll, + shallow, + ...other + } = props; - const router = useRouter(); - const pathname = typeof href === "string" ? href : href.pathname; - const className = clsx(classNameProps, { - [activeClassName]: router.pathname === pathname && activeClassName, - }); + const router = useRouter(); + const pathname = typeof href === "string" ? href : href.pathname; + const className = clsx(classNameProps, { + [activeClassName]: router.pathname === pathname && activeClassName, + }); - const isExternal = - typeof href === "string" && - (href.indexOf("http") === 0 || href.indexOf("mailto:") === 0); + const isExternal = + typeof href === "string" && + (href.indexOf("http") === 0 || href.indexOf("mailto:") === 0); - if (isExternal) { - if (noLinkStyle) { - return ; + if (isExternal) { + if (noLinkStyle) { + return ; + } + + return ; } - return ; - } + const linkAs = linkAsProp || as; + const nextjsProps = { + to: href, + linkAs, + replace, + scroll, + shallow, + prefetch, + legacyBehavior, + locale, + }; - const linkAs = linkAsProp || as; - const nextjsProps = { - to: href, - linkAs, - replace, - scroll, - shallow, - prefetch, - legacyBehavior, - locale, - }; + if (noLinkStyle) { + return ( + + ); + } - if (noLinkStyle) { return ( - + ); - } - - return ( - - ); }); export default LinkRouting; diff --git a/src/core/components/LoadingHardPage.jsx b/src/core/components/LoadingHardPage.jsx index 01ce658..9406e8f 100644 --- a/src/core/components/LoadingHardPage.jsx +++ b/src/core/components/LoadingHardPage.jsx @@ -1,44 +1,44 @@ -import { Backdrop, Fade, styled } from "@mui/material"; +import {Backdrop, Fade, styled} from "@mui/material"; import StyledImage from "./StyledImage"; const LoadingImage = styled(StyledImage)({ - "@keyframes load": { - "0%": { - // opacity: 0, - transform: "scale(1)", + "@keyframes load": { + "0%": { + // opacity: 0, + transform: "scale(1)", + }, + "50%": { + // opacity: 1, + transform: "scale(2)", + }, + "100%": { + // opacity: 0, + transform: "scale(1)", + }, }, - "50%": { - // opacity: 1, - transform: "scale(2)", - }, - "100%": { - // opacity: 0, - transform: "scale(1)", - }, - }, - animation: "load 2s infinite", + animation: "load 2s infinite", }); -const LoadingHardPage = ({ children, loading }) => { - return ( - <> - theme.zIndex.drawer + 1 }} - open={loading} - > - - - - - {children} - - ); +const LoadingHardPage = ({children, loading}) => { + return ( + <> + theme.zIndex.drawer + 1}} + open={loading} + > + + + + + {children} + + ); }; export default LoadingHardPage; diff --git a/src/core/components/Messages.jsx b/src/core/components/Messages.jsx index 2bd45c8..d5fdef9 100644 --- a/src/core/components/Messages.jsx +++ b/src/core/components/Messages.jsx @@ -2,22 +2,22 @@ import CenterLayout from "@/layouts/CenterLayout"; import FullPageLayout from "@/layouts/FullPageLayout"; import StyledImage from "./StyledImage"; -const Message = ({ text, actions }) => { - return ( - - - - {text} - {actions} - - - ); +const Message = ({text, actions}) => { + return ( + + + + {text} + {actions} + + + ); }; export default Message; diff --git a/src/core/components/PasswordField.jsx b/src/core/components/PasswordField.jsx index 5747bdb..d109b73 100644 --- a/src/core/components/PasswordField.jsx +++ b/src/core/components/PasswordField.jsx @@ -1,33 +1,33 @@ -import { useState } from "react"; -import { IconButton, InputAdornment, TextField } from "@mui/material"; -import { Visibility, VisibilityOff } from "@mui/icons-material"; -import { Field } from "formik"; +import {useState} from "react"; +import {IconButton, InputAdornment, TextField} from "@mui/material"; +import {Visibility, VisibilityOff} from "@mui/icons-material"; +import {Field} from "formik"; const PasswordField = (props) => { - const [showPassword, setShowPassword] = useState(false); + const [showPassword, setShowPassword] = useState(false); - const handleClickShowPassword = () => { - setShowPassword(!showPassword); - }; + const handleClickShowPassword = () => { + setShowPassword(!showPassword); + }; - return ( - - - {showPassword ? : } - - - ), - }} - /> - ); + return ( + + + {showPassword ? : } + + + ), + }} + /> + ); }; export default PasswordField; diff --git a/src/core/components/ResendToken.jsx b/src/core/components/ResendToken.jsx index b6430d3..1bb900e 100644 --- a/src/core/components/ResendToken.jsx +++ b/src/core/components/ResendToken.jsx @@ -1,72 +1,72 @@ import Notifications from "@/core/components/notifications"; import useDirection from "@/lib/app/hooks/useDirection"; -import { Button, Typography } from "@mui/material"; +import {Button} from "@mui/material"; import axios from "axios"; -import { useTranslations } from "next-intl"; -import { useEffect } from "react"; -import { SEND_OTP_TOKEN } from "../data/apiRoutes"; +import {useTranslations} from "next-intl"; +import {useEffect} from "react"; +import {SEND_OTP_TOKEN} from "../data/apiRoutes"; -const ResendToken = ({ initialTimerValue, timer, setTimer, PhoneNumber }) => { - const t = useTranslations(); - const { directionApp } = useDirection(); +const ResendToken = ({initialTimerValue, timer, setTimer, PhoneNumber}) => { + const t = useTranslations(); + const {directionApp} = useDirection(); - // Countdown Timer - useEffect(() => { - let interval; - if (timer > 0) { - interval = setInterval(() => { - setTimer((prevTimer) => prevTimer - 1); - }, 1000); - } else { - clearInterval(interval); - } + // Countdown Timer + useEffect(() => { + let interval; + if (timer > 0) { + interval = setInterval(() => { + setTimer((prevTimer) => prevTimer - 1); + }, 1000); + } else { + clearInterval(interval); + } - return () => clearInterval(interval); - }, [timer]); - // End Countdown Timer + return () => clearInterval(interval); + }, [timer]); + // End Countdown Timer - // Handle Resend Token - const handleResendClick = async () => { - // work on it - if (timer != 0) return; - Notifications(directionApp, t, undefined); - await axios - .post(SEND_OTP_TOKEN, { - phone_number: PhoneNumber, - }) - .then(function (response) { - Notifications(directionApp, t, response); - setTimer(initialTimerValue); - }) - .catch(function (error) { - Notifications(directionApp, t, error.response); - }); - }; - // End Handle Resend Token + // Handle Resend Token + const handleResendClick = async () => { + // work on it + if (timer != 0) return; + Notifications(directionApp, t, undefined); + await axios + .post(SEND_OTP_TOKEN, { + phone_number: PhoneNumber, + }) + .then(function (response) { + Notifications(directionApp, t, response); + setTimer(initialTimerValue); + }) + .catch(function (error) { + Notifications(directionApp, t, error.response); + }); + }; + // End Handle Resend Token - return ( - <> - {timer > 0 ? ( - - ) : ( - - )} - - ); + return ( + <> + {timer > 0 ? ( + + ) : ( + + )} + + ); }; export default ResendToken; diff --git a/src/core/components/SelectBox.jsx b/src/core/components/SelectBox.jsx index ea39d54..d2d38af 100644 --- a/src/core/components/SelectBox.jsx +++ b/src/core/components/SelectBox.jsx @@ -1,55 +1,49 @@ -import { - FormControl, - FormHelperText, - InputLabel, - MenuItem, - Select, -} from "@mui/material"; +import {FormControl, FormHelperText, InputLabel, MenuItem, Select,} from "@mui/material"; function SelectBox({ - select, - selectType, - selectors, - label, - setFieldValue, - setFieldTouched, - error, - helperText, -}) { - const handleChange = (event) => { - setFieldValue(selectType, event.target.value); - }; - const handleBlur = () => { - setFieldTouched(select, true); - }; - return ( - - {label} - - {helperText} - - ); + select, + selectType, + selectors, + label, + setFieldValue, + setFieldTouched, + error, + helperText, + }) { + const handleChange = (event) => { + setFieldValue(selectType, event.target.value); + }; + const handleBlur = () => { + setFieldTouched(select, true); + }; + return ( + + {label} + + {helperText} + + ); } export default SelectBox; diff --git a/src/core/components/StyledForm.jsx b/src/core/components/StyledForm.jsx index 1f299bb..41eeabc 100644 --- a/src/core/components/StyledForm.jsx +++ b/src/core/components/StyledForm.jsx @@ -1,5 +1,5 @@ -import { styled } from "@mui/material"; -import { Form } from "formik"; +import {styled} from "@mui/material"; +import {Form} from "formik"; const StyledForm = styled(Form)``; diff --git a/src/core/components/StyledImage.jsx b/src/core/components/StyledImage.jsx index 64391ad..58dd65f 100644 --- a/src/core/components/StyledImage.jsx +++ b/src/core/components/StyledImage.jsx @@ -1,4 +1,4 @@ -import { styled } from "@mui/material"; +import {styled} from "@mui/material"; import Image from "next/image"; const StyledImage = styled(Image)``; diff --git a/src/core/components/TitlePage.jsx b/src/core/components/TitlePage.jsx index 7bdcfc2..77c72ee 100644 --- a/src/core/components/TitlePage.jsx +++ b/src/core/components/TitlePage.jsx @@ -1,15 +1,15 @@ -import { useTranslations } from "next-intl"; +import {useTranslations} from "next-intl"; import Head from "next/head"; -const TitlePage = ({ text }) => { - const t = useTranslations(); - return ( - - - {text ? `${t("app_short_name")} | ${t(text)}` : t("app_short_name")} - - - ); +const TitlePage = ({text}) => { + const t = useTranslations(); + return ( + + + {text ? `${t("app_short_name")} | ${t(text)}` : t("app_short_name")} + + + ); }; export default TitlePage; diff --git a/src/core/components/UploadSystem.jsx b/src/core/components/UploadSystem.jsx index 3523c3e..85f38f8 100644 --- a/src/core/components/UploadSystem.jsx +++ b/src/core/components/UploadSystem.jsx @@ -1,148 +1,147 @@ -import { Box, Button, TextField, Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; +import {Box, Button, TextField, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; import Image from "next/image"; import DeleteForeverIcon from "@mui/icons-material/DeleteForever"; -import { useRef } from "react"; +import {useRef} from "react"; const UploadSystem = ({ - selectedImage, - setselectedImage, - handleUploadChange, - fieldname, - setFieldValue, - imageAlt, - imageSize, - fileType, - fileName, - label, -}) => { - const t = useTranslations(); - const fileInputRef = useRef(null); + selectedImage, + setselectedImage, + handleUploadChange, + fieldname, + setFieldValue, + imageAlt, + imageSize, + fileType, + fileName, + label, + }) => { + const t = useTranslations(); + const fileInputRef = useRef(null); - const handleClick = () => { - fileInputRef.current.click(); - }; - const handleDeleteImage = () => { - setselectedImage("/images/upload-image.svg"); - setFieldValue(fieldname, null); - }; + const handleClick = () => { + fileInputRef.current.click(); + }; + const handleDeleteImage = () => { + setselectedImage("/images/upload-image.svg"); + setFieldValue(fieldname, null); + }; - const isDocumentFormat = (fileType) => { - const documentFormats = [ - "application/pdf", - "application/msword", - "application/vnd.openxmlformats-officedocument.wordprocessingml.document", - "application/vnd.ms-excel", - "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", - ]; - return documentFormats.includes(fileType); - }; + const isDocumentFormat = (fileType) => { + const documentFormats = [ + "application/pdf", + "application/msword", + "application/vnd.openxmlformats-officedocument.wordprocessingml.document", + "application/vnd.ms-excel", + "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet", + ]; + return documentFormats.includes(fileType); + }; - return ( - - - {label} - - {selectedImage === "/images/upload-image.svg" ? ( - {imageAlt} - ) : fileType && fileType.startsWith("image/") ? ( - {imageAlt} - ) : ( - fileType && - isDocumentFormat(fileType) && ( - + return ( + - {fileName} + {label} - - ) - )} + {selectedImage === "/images/upload-image.svg" ? ( + {imageAlt} + ) : fileType && fileType.startsWith("image/") ? ( + {imageAlt} + ) : ( + fileType && + isDocumentFormat(fileType) && ( + + + {fileName} + + + ) + )} - - - - ); + + + + ); }; export default UploadSystem; - //////****** usage document ******///////// // 1.) use component inside your page // 2.) list of props that you need to send is down below diff --git a/src/core/components/isBotHandler.jsx b/src/core/components/isBotHandler.jsx index 0fde3e3..5a4c4e1 100644 --- a/src/core/components/isBotHandler.jsx +++ b/src/core/components/isBotHandler.jsx @@ -1,8 +1,8 @@ -import { NoSsr } from "@mui/material"; +import {NoSsr} from "@mui/material"; -const NoSsrHandler = ({ isBot, children }) => { - if (isBot) return children; - return {children}; +const NoSsrHandler = ({isBot, children}) => { + if (isBot) return children; + return {children}; }; export default NoSsrHandler; diff --git a/src/core/components/notifications/ErrorNotification.jsx b/src/core/components/notifications/ErrorNotification.jsx index 8e1b99a..de83927 100644 --- a/src/core/components/notifications/ErrorNotification.jsx +++ b/src/core/components/notifications/ErrorNotification.jsx @@ -1,40 +1,40 @@ import DangerousIcon from "@mui/icons-material/Dangerous"; -import { Box, Typography } from "@mui/material"; -import { toast } from "react-toastify"; +import {Box, Typography} from "@mui/material"; +import {toast} from "react-toastify"; const ErrorNotification = (directionApp, t, status, message) => { - toast( - ({ closeToast }) => ( - <> - - - - - - {t("notifications.error")} ({t("notifications.code")}: {status}) - - - {message || t("notifications.error_static_text")} - - - - - - ), - { - position: directionApp === "ltr" ? "top-left" : "top-right", - autoClose: false, - closeOnClick: false, - draggable: false, - } - ); + toast( + ({closeToast}) => ( + <> + + + + + + {t("notifications.error")} ({t("notifications.code")}: {status}) + + + {message || t("notifications.error_static_text")} + + + + + + ), + { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: false, + closeOnClick: false, + draggable: false, + } + ); }; export default ErrorNotification; diff --git a/src/core/components/notifications/SuccessNotification.jsx b/src/core/components/notifications/SuccessNotification.jsx index 420e99a..d45e0ae 100644 --- a/src/core/components/notifications/SuccessNotification.jsx +++ b/src/core/components/notifications/SuccessNotification.jsx @@ -1,43 +1,43 @@ import BeenhereIcon from "@mui/icons-material/Beenhere"; -import { Box, Typography } from "@mui/material"; -import { toast } from "react-toastify"; +import {Box, Typography} from "@mui/material"; +import {toast} from "react-toastify"; const SuccessNotification = (directionApp, t, status) => { - toast( - () => ( - <> - - - - - - {t("notifications.success")} ({t("notifications.code")}:{" "} - {status}) - - - {t("notifications.success_static_text")} - - - - - - ), - { - position: directionApp === "ltr" ? "top-left" : "top-right", - autoClose: 3000, - hideProgressBar: true, - pauseOnHover: true, - closeOnClick: false, - draggable: true, - } - ); + toast( + () => ( + <> + + + + + + {t("notifications.success")} ({t("notifications.code")}:{" "} + {status}) + + + {t("notifications.success_static_text")} + + + + + + ), + { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: 3000, + hideProgressBar: true, + pauseOnHover: true, + closeOnClick: false, + draggable: true, + } + ); }; export default SuccessNotification; diff --git a/src/core/components/notifications/WarningNotification.jsx b/src/core/components/notifications/WarningNotification.jsx index 1451031..59ea1ba 100644 --- a/src/core/components/notifications/WarningNotification.jsx +++ b/src/core/components/notifications/WarningNotification.jsx @@ -1,41 +1,41 @@ import ReportIcon from "@mui/icons-material/Report"; -import { Box, Divider, Typography } from "@mui/material"; -import { toast } from "react-toastify"; +import {Box, Divider, Typography} from "@mui/material"; +import {toast} from "react-toastify"; const WarningNotification = (directionApp, t, status) => { - toast( - ({ closeToast }) => ( - <> - - - - - - {t("warning")} ({t("code")}: {status}) - - - {t("warning_static_text")} - - - - - - - ), - { - position: directionApp === "ltr" ? "top-left" : "top-right", - autoClose: false, - closeOnClick: false, - draggable: false, - } - ); + toast( + ({closeToast}) => ( + <> + + + + + + {t("warning")} ({t("code")}: {status}) + + + {t("warning_static_text")} + + + + + + + ), + { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: false, + closeOnClick: false, + draggable: false, + } + ); }; export default WarningNotification; diff --git a/src/core/components/notifications/index.jsx b/src/core/components/notifications/index.jsx index f27d437..1bf664e 100644 --- a/src/core/components/notifications/index.jsx +++ b/src/core/components/notifications/index.jsx @@ -1,45 +1,45 @@ -import { toast } from "react-toastify"; +import {toast} from "react-toastify"; import ErrorNotification from "./ErrorNotification"; import SuccessNotification from "./SuccessNotification"; import WarningNotification from "./WarningNotification"; const Notifications = async (directionApp, t, response) => { - const { status, data } = response != undefined ? response : "" - toast.dismiss(); - switch (status) { - case 200: - SuccessNotification(directionApp, t, status); - break; - case 400: - ErrorNotification(directionApp, t,status); - break; - case 401: - ErrorNotification(directionApp, t, status); - break; - case 403: - ErrorNotification(directionApp, t, status); - break; - case 422: - ErrorNotification(directionApp, t, status, data.message); - break; - case 500: - WarningNotification(directionApp, t, status); - break; - case 503: - WarningNotification(directionApp, t, status); - break; - case 504: - WarningNotification(directionApp, t, status); - break; - default: - toast(t("pending"), { - position: directionApp === "ltr" ? "top-left" : "top-right", - autoClose: false, - closeOnClick: false, - draggable: false, - }); - break; - } + const {status, data} = response != undefined ? response : "" + toast.dismiss(); + switch (status) { + case 200: + SuccessNotification(directionApp, t, status); + break; + case 400: + ErrorNotification(directionApp, t, status); + break; + case 401: + ErrorNotification(directionApp, t, status); + break; + case 403: + ErrorNotification(directionApp, t, status); + break; + case 422: + ErrorNotification(directionApp, t, status, data.message); + break; + case 500: + WarningNotification(directionApp, t, status); + break; + case 503: + WarningNotification(directionApp, t, status); + break; + case 504: + WarningNotification(directionApp, t, status); + break; + default: + toast(t("pending"), { + position: directionApp === "ltr" ? "top-left" : "top-right", + autoClose: false, + closeOnClick: false, + draggable: false, + }); + break; + } }; export default Notifications; diff --git a/src/core/data/headerProfileItems.jsx b/src/core/data/headerProfileItems.jsx index 90831ba..8164f38 100644 --- a/src/core/data/headerProfileItems.jsx +++ b/src/core/data/headerProfileItems.jsx @@ -1,7 +1,3 @@ -import BorderColorIcon from "@mui/icons-material/BorderColor"; -import PasswordIcon from "@mui/icons-material/Password"; - -const headerProfileItems = [ -]; +const headerProfileItems = []; export default headerProfileItems; diff --git a/src/core/data/sidebarMenu.jsx b/src/core/data/sidebarMenu.jsx index cc01fa6..8027ccf 100644 --- a/src/core/data/sidebarMenu.jsx +++ b/src/core/data/sidebarMenu.jsx @@ -3,29 +3,29 @@ import BookmarkAddedIcon from "@mui/icons-material/BookmarkAdded"; import DataSaverOnIcon from "@mui/icons-material/DataSaverOn"; const sidebarMenu = [ - [ - { - key: "sidebar.dashboard", - type: "page", - route: "/dashboard", - icon: , - selected: false, - }, - { - key: "sidebar.loan-request", - type: "page", - route: "/dashboard/loan-request", - icon: , - selected: false, - }, - { - key: "sidebar.loan-follow-up", - type: "page", - route: "/dashboard/loan-follow-up", - icon: , - selected: false, - }, - ], + [ + { + key: "sidebar.dashboard", + type: "page", + route: "/dashboard", + icon: , + selected: false, + }, + { + key: "sidebar.loan-request", + type: "page", + route: "/dashboard/loan-request", + icon: , + selected: false, + }, + { + key: "sidebar.loan-follow-up", + type: "page", + route: "/dashboard/loan-follow-up", + icon: , + selected: false, + }, + ], ]; export default sidebarMenu; diff --git a/src/core/utils/createEmotionCache.jsx b/src/core/utils/createEmotionCache.jsx index 06add02..413fafe 100644 --- a/src/core/utils/createEmotionCache.jsx +++ b/src/core/utils/createEmotionCache.jsx @@ -1,38 +1,38 @@ import createCache from "@emotion/cache"; -import { prefixer } from "stylis"; +import {prefixer} from "stylis"; import stylisRTLPlugin from "stylis-plugin-rtl"; const isBrowser = typeof document !== "undefined"; export const createEmotionCacheLtr = () => { - let insertionPoint; + let insertionPoint; - if (isBrowser) { - const emotionInsertionPoint = document.querySelector( - 'meta[name="emotion-insertion-point"]' - ); - insertionPoint = emotionInsertionPoint ?? undefined; - } + if (isBrowser) { + const emotionInsertionPoint = document.querySelector( + 'meta[name="emotion-insertion-point"]' + ); + insertionPoint = emotionInsertionPoint ?? undefined; + } - return createCache({ - key: "mui-style", - insertionPoint, - }); + return createCache({ + key: "mui-style", + insertionPoint, + }); }; export const createEmotionCacheRtl = () => { - let insertionPoint; + let insertionPoint; - if (isBrowser) { - const emotionInsertionPoint = document.querySelector( - 'meta[name="emotion-insertion-point"]' - ); - insertionPoint = emotionInsertionPoint ?? undefined; - } + if (isBrowser) { + const emotionInsertionPoint = document.querySelector( + 'meta[name="emotion-insertion-point"]' + ); + insertionPoint = emotionInsertionPoint ?? undefined; + } - return createCache({ - key: "muirtl", - stylisPlugins: [prefixer, stylisRTLPlugin], - insertionPoint, - }); + return createCache({ + key: "muirtl", + stylisPlugins: [prefixer, stylisRTLPlugin], + insertionPoint, + }); }; diff --git a/src/core/utils/theme-rtl.jsx b/src/core/utils/theme-rtl.jsx index c36abeb..bab1c3a 100644 --- a/src/core/utils/theme-rtl.jsx +++ b/src/core/utils/theme-rtl.jsx @@ -1,12 +1,12 @@ -import { createTheme } from "@mui/material/styles"; +import {createTheme} from "@mui/material/styles"; import theme from "./theme"; const themeRtl = createTheme({ - direction: "rtl", - typography: { - fontFamily: `IRANSans, sans-serif`, - }, - ...theme, + direction: "rtl", + typography: { + fontFamily: `IRANSans, sans-serif`, + }, + ...theme, }); export default themeRtl; diff --git a/src/core/utils/theme.jsx b/src/core/utils/theme.jsx index 0a36eee..54ba0b2 100644 --- a/src/core/utils/theme.jsx +++ b/src/core/utils/theme.jsx @@ -1,18 +1,18 @@ const theme = { - palette: { - primary: { - main: "#084070", - contrastText: "#fff", - light: "#2c6291", - dark: "#11293e", + palette: { + primary: { + main: "#084070", + contrastText: "#fff", + light: "#2c6291", + dark: "#11293e", + }, + secondary: { + main: "#FF4E00", + contrastText: "#fff", + light: "#ed743e", + dark: "#ad3a07", + }, }, - secondary: { - main: "#FF4E00", - contrastText: "#fff", - light: "#ed743e", - dark: "#ad3a07", - }, - }, }; export default theme; diff --git a/src/layouts/AppLayout.jsx b/src/layouts/AppLayout.jsx index fc4445f..d2c5da5 100644 --- a/src/layouts/AppLayout.jsx +++ b/src/layouts/AppLayout.jsx @@ -4,96 +4,96 @@ import useLoading from "@/lib/app/hooks/useLoading"; import useUser from "@/lib/app/hooks/useUser"; import Head from "next/head"; import NextNProgress from "nextjs-progressbar"; -import { useEffect } from "react"; +import {useEffect} from "react"; -function AppLayout({ children, isBot }) { - const { languageIsReady } = useLanguage(); - const { setLoadingPage } = useLoading(); - const { userChangedLanguage, token, isAuth } = useUser(); - useEffect(() => { - if (languageIsReady) { - if (token) { - if (isAuth) { - if (userChangedLanguage) { - setLoadingPage(true); +function AppLayout({children, isBot}) { + const {languageIsReady} = useLanguage(); + const {setLoadingPage} = useLoading(); + const {userChangedLanguage, token, isAuth} = useUser(); + useEffect(() => { + if (languageIsReady) { + if (token) { + if (isAuth) { + if (userChangedLanguage) { + setLoadingPage(true); + return; + } + setLoadingPage(false); + return; + } + setLoadingPage(true); + return; + } + setLoadingPage(false); return; - } - setLoadingPage(false); - return; } setLoadingPage(true); - return; - } - setLoadingPage(false); - return; + }, [languageIsReady, token, isAuth, userChangedLanguage]); + + if (!isBot) { + if (userChangedLanguage) return; + if (!languageIsReady) return; } - setLoadingPage(true); - }, [languageIsReady, token, isAuth, userChangedLanguage]); - if (!isBot) { - if (userChangedLanguage) return; - if (!languageIsReady) return; - } - - return ( - <> - - - - - - - - - - - - - - - - - - - - - - {children} - - ); + return ( + <> + + + + + + + + + + + + + + + + + + + + + + {children} + + ); } export default AppLayout; diff --git a/src/layouts/CenterLayout.jsx b/src/layouts/CenterLayout.jsx index 4c8767f..1e1b8bf 100644 --- a/src/layouts/CenterLayout.jsx +++ b/src/layouts/CenterLayout.jsx @@ -1,18 +1,18 @@ -import { Fade, Stack } from "@mui/material"; +import {Fade, Stack} from "@mui/material"; const CenterLayout = (props) => { - return ( - - - {props.children} - - - ); + return ( + + + {props.children} + + + ); }; export default CenterLayout; diff --git a/src/layouts/FullPageLayout.jsx b/src/layouts/FullPageLayout.jsx index cbf2102..d6ed61e 100644 --- a/src/layouts/FullPageLayout.jsx +++ b/src/layouts/FullPageLayout.jsx @@ -1,21 +1,21 @@ -import { Stack } from "@mui/material"; +import {Stack} from "@mui/material"; const FullPageLayout = (props) => { - return ( - - {props.children} - - ); + return ( + + {props.children} + + ); }; export default FullPageLayout; diff --git a/src/layouts/MuiLayout.jsx b/src/layouts/MuiLayout.jsx index ba891d0..2614ac2 100644 --- a/src/layouts/MuiLayout.jsx +++ b/src/layouts/MuiLayout.jsx @@ -1,76 +1,74 @@ import NoSsrHandler from "@/core/components/isBotHandler"; -import { - createEmotionCacheRtl -} from "@/core/utils/createEmotionCache"; +import {createEmotionCacheRtl} from "@/core/utils/createEmotionCache"; import themeRtl from "@/core/utils/theme-rtl"; -import { CacheProvider } from "@emotion/react"; -import { GlobalStyles } from "@mui/material"; +import {CacheProvider} from "@emotion/react"; +import {GlobalStyles} from "@mui/material"; import CssBaseline from "@mui/material/CssBaseline"; -import { ThemeProvider } from "@mui/material/styles"; +import {ThemeProvider} from "@mui/material/styles"; import Head from "next/head"; const clientSideEmotionCacheRtl = createEmotionCacheRtl(); -const MuiLayout = ({ children, isBot }) => { +const MuiLayout = ({children, isBot}) => { - const emotionCache = clientSideEmotionCacheRtl; + const emotionCache = clientSideEmotionCacheRtl; - const theme = themeRtl; - return ( - - - - - - - + + + + + + + body: { + width: "100vw", + height: "100vh", + }, + "#__next": { + width: "100%", + height: "100%", + }, + }} + /> - - {children} - - - - ); + + {children} + + + + ); }; export default MuiLayout; diff --git a/src/layouts/ScrollableLayout.jsx b/src/layouts/ScrollableLayout.jsx index 5ab58ca..583edd7 100644 --- a/src/layouts/ScrollableLayout.jsx +++ b/src/layouts/ScrollableLayout.jsx @@ -1,25 +1,25 @@ -import { Box, Fade } from "@mui/material"; +import {Box, Fade} from "@mui/material"; const ScrollableLayout = (props) => { - const overflowY = props?.y || "hidden"; - const overflowX = props?.x || "hidden"; + const overflowY = props?.y || "hidden"; + const overflowX = props?.x || "hidden"; - return ( - - - {props.children} - - - ); + return ( + + + {props.children} + + + ); }; export default ScrollableLayout; diff --git a/src/layouts/dashboardLayouts/breadcrumbs/BreadcrumbItem.jsx b/src/layouts/dashboardLayouts/breadcrumbs/BreadcrumbItem.jsx index ccff4c9..c233be3 100644 --- a/src/layouts/dashboardLayouts/breadcrumbs/BreadcrumbItem.jsx +++ b/src/layouts/dashboardLayouts/breadcrumbs/BreadcrumbItem.jsx @@ -1,19 +1,19 @@ import LinkRouting from "@/core/components/LinkRouting"; -import { Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; +import {Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; export default function BreadcrumbItem(props) { - const t = useTranslations(); - const isLast = props.index === props.RouterArray.length - 1; - const url = `/${props.RouterArray.slice(0, props.index + 1).join("/")}`; + const t = useTranslations(); + const isLast = props.index === props.RouterArray.length - 1; + const url = `/${props.RouterArray.slice(0, props.index + 1).join("/")}`; - return isLast ? ( - - {t("sidebar." + props.label)} - - ) : ( - - {t("sidebar." + props.label)} - - ); + return isLast ? ( + + {t("sidebar." + props.label)} + + ) : ( + + {t("sidebar." + props.label)} + + ); } diff --git a/src/layouts/dashboardLayouts/breadcrumbs/index.jsx b/src/layouts/dashboardLayouts/breadcrumbs/index.jsx index 3123a12..9ab234e 100644 --- a/src/layouts/dashboardLayouts/breadcrumbs/index.jsx +++ b/src/layouts/dashboardLayouts/breadcrumbs/index.jsx @@ -1,49 +1,49 @@ -import { useRouter } from "next/router"; -import { Box, Breadcrumbs } from "@mui/material"; -import { useTheme } from "@mui/material/styles"; -import { NavigateBefore, NavigateNext } from "@mui/icons-material"; +import {useRouter} from "next/router"; +import {Box, Breadcrumbs} from "@mui/material"; +import {useTheme} from "@mui/material/styles"; +import {NavigateBefore, NavigateNext} from "@mui/icons-material"; import BreadcrumbItem from "./BreadcrumbItem"; const BreadCrumbs = (props) => { - const { isVisible } = props; - const theme = useTheme(); - const router = useRouter(); + const {isVisible} = props; + const theme = useTheme(); + const router = useRouter(); - if (!isVisible) { - return null; - } + if (!isVisible) { + return null; + } - const { pathname } = router; - const RouterArray = pathname.split("/").filter((segment) => segment !== ""); + const {pathname} = router; + const RouterArray = pathname.split("/").filter((segment) => segment !== ""); - if (RouterArray.length === 1) { - return null; - } + if (RouterArray.length === 1) { + return null; + } - return ( - - - ) : ( - - ) - } - aria-label="breadcrumb" - > - {RouterArray.map((segment, index) => ( - - ))} - - - ); + return ( + + + ) : ( + + ) + } + aria-label="breadcrumb" + > + {RouterArray.map((segment, index) => ( + + ))} + + + ); }; export default BreadCrumbs; diff --git a/src/layouts/dashboardLayouts/header/ProfileData.jsx b/src/layouts/dashboardLayouts/header/ProfileData.jsx index eb25403..13ceda1 100644 --- a/src/layouts/dashboardLayouts/header/ProfileData.jsx +++ b/src/layouts/dashboardLayouts/header/ProfileData.jsx @@ -1,15 +1,15 @@ -import { Avatar, Stack, Typography } from "@mui/material"; +import {Avatar, Stack} from "@mui/material"; import useUser from "@/lib/app/hooks/useUser"; export default function ProfileData() { - const { user } = useUser(); - return ( - - - - ); + const {user} = useUser(); + return ( + + + + ); } diff --git a/src/layouts/dashboardLayouts/header/ProfileMenu.jsx b/src/layouts/dashboardLayouts/header/ProfileMenu.jsx index 50f34db..e628e52 100644 --- a/src/layouts/dashboardLayouts/header/ProfileMenu.jsx +++ b/src/layouts/dashboardLayouts/header/ProfileMenu.jsx @@ -1,61 +1,62 @@ -import { Avatar, Menu, IconButton, Tooltip } from "@mui/material"; -import { useState } from "react"; +import {Avatar, IconButton, Menu, Tooltip} from "@mui/material"; +import {useState} from "react"; import ProfileData from "./ProfileData"; import ProfileOptions from "./ProfileOptions"; -import { useTranslations } from "next-intl"; +import {useTranslations} from "next-intl"; import useUser from "@/lib/app/hooks/useUser"; function ProfileMenu() { - const t = useTranslations(); - const [anchorElUser, setAnchorElUser] = useState(null); - const { user } = useUser(); + const t = useTranslations(); + const [anchorElUser, setAnchorElUser] = useState(null); + const {user} = useUser(); - const handleOpenUserMenu = (event) => { - setAnchorElUser(event.currentTarget); - }; - const handleCloseUserMenu = () => { - setAnchorElUser(null); - }; + const handleOpenUserMenu = (event) => { + setAnchorElUser(event.currentTarget); + }; + const handleCloseUserMenu = () => { + setAnchorElUser(null); + }; - return ( - <> - - - - - - - - - - - ); + return ( + <> + + + + + + + + + + + ); } + export default ProfileMenu; diff --git a/src/layouts/dashboardLayouts/header/ProfileOptionLogOut.jsx b/src/layouts/dashboardLayouts/header/ProfileOptionLogOut.jsx index f56db6c..2a6cf85 100644 --- a/src/layouts/dashboardLayouts/header/ProfileOptionLogOut.jsx +++ b/src/layouts/dashboardLayouts/header/ProfileOptionLogOut.jsx @@ -1,49 +1,49 @@ -import { Box, Button, MenuItem, Typography } from "@mui/material"; +import {Box, Button, MenuItem, Typography} from "@mui/material"; import MeetingRoomIcon from "@mui/icons-material/MeetingRoom"; import useUser from "@/lib/app/hooks/useUser"; -import { useTranslations } from "next-intl"; +import {useTranslations} from "next-intl"; -export default function ProfileOptionLogOut({ handleCloseUserMenu }) { - const t = useTranslations(); - const { clearToken } = useUser(); - const handleClickLogOut = () => { - handleCloseUserMenu(); - clearToken(); - }; - return ( - <> - - - - - - - {t("header.logout")} - - - - - ); +export default function ProfileOptionLogOut({handleCloseUserMenu}) { + const t = useTranslations(); + const {clearToken} = useUser(); + const handleClickLogOut = () => { + handleCloseUserMenu(); + clearToken(); + }; + return ( + <> + + + + + + + {t("header.logout")} + + + + + ); } diff --git a/src/layouts/dashboardLayouts/header/ProfileOptions.jsx b/src/layouts/dashboardLayouts/header/ProfileOptions.jsx index bf63212..6e7bdba 100644 --- a/src/layouts/dashboardLayouts/header/ProfileOptions.jsx +++ b/src/layouts/dashboardLayouts/header/ProfileOptions.jsx @@ -1,49 +1,49 @@ -import { Box, MenuItem, Typography } from "@mui/material"; -import { NextLinkComposed } from "@/core/components/LinkRouting"; -import { useTranslations } from "next-intl"; +import {Box, MenuItem, Typography} from "@mui/material"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; +import {useTranslations} from "next-intl"; import headerProfileItems from "@/core/data/headerProfileItems"; import ProfileOptionLogOut from "./ProfileOptionLogOut"; -export default function ProfileOptions({ handleCloseUserMenu }) { - const t = useTranslations(); +export default function ProfileOptions({handleCloseUserMenu}) { + const t = useTranslations(); - return ( - <> - {headerProfileItems.map((profile_item) => ( - - - - {profile_item.icon} - - - {t(profile_item.name)} - - - - ))} - - - ); + return ( + <> + {headerProfileItems.map((profile_item) => ( + + + + {profile_item.icon} + + + {t(profile_item.name)} + + + + ))} + + + ); } diff --git a/src/layouts/dashboardLayouts/header/index.jsx b/src/layouts/dashboardLayouts/header/index.jsx index cd1e4a0..8760960 100644 --- a/src/layouts/dashboardLayouts/header/index.jsx +++ b/src/layouts/dashboardLayouts/header/index.jsx @@ -1,80 +1,72 @@ import MenuIcon from "@mui/icons-material/Menu"; -import { - AppBar, - Box, - Container, - CssBaseline, - IconButton, - Stack, - Toolbar, - useTheme -} from "@mui/material"; +import {AppBar, Box, Container, CssBaseline, IconButton, Stack, Toolbar, useTheme} from "@mui/material"; import ProfileMenu from "./ProfileMenu"; -function Header({ drawerWidth, handleDrawerToggle }) { - const theme = useTheme(); +function Header({drawerWidth, handleDrawerToggle}) { + const theme = useTheme(); - return ( - <> - - - - - - - - - - - + + - - - - - - - - - - ); + > + + + + + + + + + + + + + + + + + + + ); } + export default Header; diff --git a/src/layouts/dashboardLayouts/index.jsx b/src/layouts/dashboardLayouts/index.jsx index f1478bf..ed0ee31 100644 --- a/src/layouts/dashboardLayouts/index.jsx +++ b/src/layouts/dashboardLayouts/index.jsx @@ -1,50 +1,50 @@ -import { useState } from "react"; +import {useState} from "react"; import FullPageLayout from "../FullPageLayout"; import Header from "./header"; import Sidebar from "./sidebar"; -import { Toolbar } from "@mui/material"; +import {Toolbar} from "@mui/material"; import BreadCrumbs from "./breadcrumbs"; -import { ToastContainer } from "react-toastify"; +import {ToastContainer} from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import useDirection from "@/lib/app/hooks/useDirection"; const drawerWidth = 240; const DashboardLayouts = (props) => { - const { directionApp } = useDirection(); - const { window } = props; - const [mobileOpen, setMobileOpen] = useState(false); - const container = - window !== undefined ? () => window().document.body : undefined; + const {directionApp} = useDirection(); + const {window} = props; + const [mobileOpen, setMobileOpen] = useState(false); + const container = + window !== undefined ? () => window().document.body : undefined; - const handleDrawerToggle = () => { - setMobileOpen(!mobileOpen); - }; - return ( - -
- - - - - - {props.children} + const handleDrawerToggle = () => { + setMobileOpen(!mobileOpen); + }; + return ( + +
+ + + + + + {props.children} + + + {directionApp === "rtl" ? : } - - {directionApp === "rtl" ? : } - - ); + ); }; export default DashboardLayouts; diff --git a/src/layouts/dashboardLayouts/sidebar/SidebarDrawer.jsx b/src/layouts/dashboardLayouts/sidebar/SidebarDrawer.jsx index 466c743..5eff37a 100644 --- a/src/layouts/dashboardLayouts/sidebar/SidebarDrawer.jsx +++ b/src/layouts/dashboardLayouts/sidebar/SidebarDrawer.jsx @@ -1,26 +1,26 @@ import useUser from "@/lib/app/hooks/useUser"; -import { Divider, Stack, Toolbar, Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; +import {Divider, Stack, Toolbar, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; import SidebarList from "./SidebarList"; -const SidebarDrawer = ({ handleDrawerToggle }) => { - const { user } = useUser(); - const t = useTranslations(); +const SidebarDrawer = ({handleDrawerToggle}) => { + const {user} = useUser(); + const t = useTranslations(); - return ( - <> - - - - {t("app_short_name")} - - {user.type_name} - - - - - - ); + return ( + <> + + + + {t("app_short_name")} + + {user.type_name} + + + + + + ); }; export default SidebarDrawer; diff --git a/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx b/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx index 79dd93e..2d4019c 100644 --- a/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx +++ b/src/layouts/dashboardLayouts/sidebar/SidebarList.jsx @@ -1,56 +1,56 @@ -import { Divider, List } from "@mui/material"; -import { Fragment, useEffect, useReducer } from "react"; +import {Divider, List} from "@mui/material"; +import {Fragment, useEffect, useReducer} from "react"; import SidebarListItem from "./SidebarListItem"; import sidebarMenu from "@/core/data/sidebarMenu"; -import { useRouter } from "next/router"; +import {useRouter} from "next/router"; function reducer(state, action) { - switch (action.type) { - case "COLLAPSE_MENU": - return state.map((itemsArr) => - itemsArr.map((item) => - action.key == item.key - ? { ...item, showSubItem: !item.showSubItem } - : item - ) - ); - case "SELECTED": - return state.map((itemsArr) => - itemsArr.map((item) => - action.route == item.route - ? { ...item, selected: true } - : { ...item, selected: false } - ) - ); - default: - throw new Error(); - } + switch (action.type) { + case "COLLAPSE_MENU": + return state.map((itemsArr) => + itemsArr.map((item) => + action.key == item.key + ? {...item, showSubItem: !item.showSubItem} + : item + ) + ); + case "SELECTED": + return state.map((itemsArr) => + itemsArr.map((item) => + action.route == item.route + ? {...item, selected: true} + : {...item, selected: false} + ) + ); + default: + throw new Error(); + } } -export default function SidebarList({ handleDrawerToggle }) { - const [itemMenu, dispatch] = useReducer(reducer, sidebarMenu); +export default function SidebarList({handleDrawerToggle}) { + const [itemMenu, dispatch] = useReducer(reducer, sidebarMenu); - // activate current page in menu - const router = useRouter(); - useEffect(() => { - dispatch({ type: "SELECTED", route: router.pathname }); - }, [router.pathname]); + // activate current page in menu + const router = useRouter(); + useEffect(() => { + dispatch({type: "SELECTED", route: router.pathname}); + }, [router.pathname]); - return ( - - {itemMenu.map((itemArr, index) => ( - - {itemArr.map((item) => ( - - ))} - - - ))} - - ); + return ( + + {itemMenu.map((itemArr, index) => ( + + {itemArr.map((item) => ( + + ))} + + + ))} + + ); } diff --git a/src/layouts/dashboardLayouts/sidebar/SidebarListItem.jsx b/src/layouts/dashboardLayouts/sidebar/SidebarListItem.jsx index ba270a5..f663413 100644 --- a/src/layouts/dashboardLayouts/sidebar/SidebarListItem.jsx +++ b/src/layouts/dashboardLayouts/sidebar/SidebarListItem.jsx @@ -1,64 +1,59 @@ -import { NextLinkComposed } from "@/core/components/LinkRouting"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; import ExpandLess from "@mui/icons-material/ExpandLess"; import ExpandMore from "@mui/icons-material/ExpandMore"; -import { - ListItem, - ListItemButton, - ListItemIcon, - ListItemText, -} from "@mui/material"; -import { useTranslations } from "next-intl"; -import { Fragment } from "react"; +import {ListItem, ListItemButton, ListItemIcon, ListItemText,} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {Fragment} from "react"; import SidebarListSubItem from "./SidebarListSubItem"; -const SidebarListItem = ({ item, dispatch, handleDrawerToggle }) => { - const t = useTranslations(); +const SidebarListItem = ({item, dispatch, handleDrawerToggle}) => { + const t = useTranslations(); - return ( - - - { - if (item.type == "menu") { - dispatch({ type: "COLLAPSE_MENU", key: item.key }); - } - handleDrawerToggle(); - }} - sx={{ - minHeight: 48, - }} - > - - {item.icon} - - + return ( + + + { + if (item.type == "menu") { + dispatch({type: "COLLAPSE_MENU", key: item.key}); + } + handleDrawerToggle(); + }} + sx={{ + minHeight: 48, + }} + > + + {item.icon} + + - {item.type == "menu" && - (item.showSubItem ? : )} - - - {item.subItem && ( - - )} - - ); + {item.type == "menu" && + (item.showSubItem ? : )} + + + {item.subItem && ( + + )} + + ); }; export default SidebarListItem; diff --git a/src/layouts/dashboardLayouts/sidebar/SidebarListSubItem.jsx b/src/layouts/dashboardLayouts/sidebar/SidebarListSubItem.jsx index f960efb..3407081 100644 --- a/src/layouts/dashboardLayouts/sidebar/SidebarListSubItem.jsx +++ b/src/layouts/dashboardLayouts/sidebar/SidebarListSubItem.jsx @@ -1,54 +1,48 @@ -import { NextLinkComposed } from "@/core/components/LinkRouting"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; import InboxIcon from "@mui/icons-material/MoveToInbox"; -import { - Collapse, - List, - ListItemButton, - ListItemIcon, - ListItemText, -} from "@mui/material"; -import { useTranslations } from "next-intl"; -import { Fragment } from "react"; +import {Collapse, List, ListItemButton, ListItemIcon, ListItemText,} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {Fragment} from "react"; -const SidebarListSubItem = ({ item, handleDrawerToggle }) => { - const t = useTranslations(); +const SidebarListSubItem = ({item, handleDrawerToggle}) => { + const t = useTranslations(); - return ( - - - {item.subItem.map((subitem, index) => ( - - { - if (item.type == "menu") { - dispatch({ type: "COLLAPSE_MENU", key: item.key }); - } - handleDrawerToggle(); - }} - > - - - - - - - ))} - - - ); + return ( + + + {item.subItem.map((subitem, index) => ( + + { + if (item.type == "menu") { + dispatch({type: "COLLAPSE_MENU", key: item.key}); + } + handleDrawerToggle(); + }} + > + + + + + + + ))} + + + ); }; export default SidebarListSubItem; diff --git a/src/layouts/dashboardLayouts/sidebar/index.jsx b/src/layouts/dashboardLayouts/sidebar/index.jsx index dcf7fe2..2498dfd 100644 --- a/src/layouts/dashboardLayouts/sidebar/index.jsx +++ b/src/layouts/dashboardLayouts/sidebar/index.jsx @@ -1,46 +1,46 @@ -import { Box, Drawer } from "@mui/material"; +import {Box, Drawer} from "@mui/material"; import SidebarDrawer from "./SidebarDrawer"; const Sidebar = (props) => { - return ( - - - - - - - - - ); + return ( + + + + + + + + + ); }; export default Sidebar; diff --git a/src/lib/app/contexts/language.jsx b/src/lib/app/contexts/language.jsx index c8ac313..e3f41f4 100644 --- a/src/lib/app/contexts/language.jsx +++ b/src/lib/app/contexts/language.jsx @@ -1,99 +1,99 @@ -import { FA_DATATABLE_LOCALIZATION } from "&/locales/fa/datatable"; -import { useRouter } from "next/router"; -import { createContext, useEffect, useState } from "react"; +import {FA_DATATABLE_LOCALIZATION} from "&/locales/fa/datatable"; +import {useRouter} from "next/router"; +import {createContext, useEffect, useState} from "react"; import useUser from "../hooks/useUser"; export const LanguageContext = createContext(); -export const LanguageProvider = ({ children }) => { - const router = useRouter(); - const languageList = [ - { - key: "fa", - dir: "rtl", - name: "فارسی", - fontFamily: `IRANSans, sans-serif`, - tableLocalization: FA_DATATABLE_LOCALIZATION, - } - ]; - const { user, userChangedLanguage, changeLanguageState } = useUser(); - const [languageIsReady, setLanguageIsReady] = useState(false); - const [languageApp, setLanguageApp] = useState(); - const [directionApp, setDirectionApp] = useState( - process.env.NEXT_PUBLIC_DEFAULT_DIRECTION - ); - - useEffect(() => { - const lang = localStorage.getItem("_language"); - - if (!lang && !languageApp) { - setLanguageApp(process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE); - } else if (lang) { - setLanguageApp(lang); - } - }, []); - - useEffect(() => { - if (!languageApp) return; - - const lang = localStorage.getItem("_language"); - - if (!lang) { - localStorage.setItem("_language", languageApp); - } else { - if (languageApp != lang) { - localStorage.setItem("_language", languageApp); - } - } - }, [languageApp]); - - useEffect(() => { - if (!router.isReady) return; - if (user.user_language) { - if (user.user_language != languageApp) { - setLanguageApp(user.user_language); - return; - } - } - - if (languageApp != router.locale) { - router.replace( - { pathname: router.pathname, query: router.query }, - router.asPath, +export const LanguageProvider = ({children}) => { + const router = useRouter(); + const languageList = [ { - locale: languageApp, + key: "fa", + dir: "rtl", + name: "فارسی", + fontFamily: `IRANSans, sans-serif`, + tableLocalization: FA_DATATABLE_LOCALIZATION, } - ); - return; - } - for (const lang of languageList) { - if (languageApp != lang.key) continue; - setDirectionApp(lang.dir); - document.dir = lang.dir; - } + ]; + const {user, userChangedLanguage, changeLanguageState} = useUser(); + const [languageIsReady, setLanguageIsReady] = useState(false); + const [languageApp, setLanguageApp] = useState(); + const [directionApp, setDirectionApp] = useState( + process.env.NEXT_PUBLIC_DEFAULT_DIRECTION + ); - const timer = setTimeout(() => { - changeLanguageState(false); - setLanguageIsReady(true); - }, 1000); + useEffect(() => { + const lang = localStorage.getItem("_language"); - return () => { - clearTimeout(timer); - }; - }, [router.locale, router.isReady, userChangedLanguage, languageApp]); + if (!lang && !languageApp) { + setLanguageApp(process.env.NEXT_PUBLIC_DEFAULT_LANGUAGE); + } else if (lang) { + setLanguageApp(lang); + } + }, []); - return ( - - {children} - - ); + useEffect(() => { + if (!languageApp) return; + + const lang = localStorage.getItem("_language"); + + if (!lang) { + localStorage.setItem("_language", languageApp); + } else { + if (languageApp != lang) { + localStorage.setItem("_language", languageApp); + } + } + }, [languageApp]); + + useEffect(() => { + if (!router.isReady) return; + if (user.user_language) { + if (user.user_language != languageApp) { + setLanguageApp(user.user_language); + return; + } + } + + if (languageApp != router.locale) { + router.replace( + {pathname: router.pathname, query: router.query}, + router.asPath, + { + locale: languageApp, + } + ); + return; + } + for (const lang of languageList) { + if (languageApp != lang.key) continue; + setDirectionApp(lang.dir); + document.dir = lang.dir; + } + + const timer = setTimeout(() => { + changeLanguageState(false); + setLanguageIsReady(true); + }, 1000); + + return () => { + clearTimeout(timer); + }; + }, [router.locale, router.isReady, userChangedLanguage, languageApp]); + + return ( + + {children} + + ); }; diff --git a/src/lib/app/contexts/loading.jsx b/src/lib/app/contexts/loading.jsx index 6e95a8c..f5b8a47 100644 --- a/src/lib/app/contexts/loading.jsx +++ b/src/lib/app/contexts/loading.jsx @@ -1,14 +1,14 @@ import LoadingHardPage from "@/core/components/LoadingHardPage"; -import { createContext, useState } from "react"; +import {createContext, useState} from "react"; export const LoadingContext = createContext(); -export const LoadingProvider = ({ children }) => { - const [loadingPage, setLoadingPage] = useState(false); - return ( - - - {children} - - ); +export const LoadingProvider = ({children}) => { + const [loadingPage, setLoadingPage] = useState(false); + return ( + + + {children} + + ); }; diff --git a/src/lib/app/contexts/user.jsx b/src/lib/app/contexts/user.jsx index e859c58..ccfdb22 100644 --- a/src/lib/app/contexts/user.jsx +++ b/src/lib/app/contexts/user.jsx @@ -1,121 +1,122 @@ -import { USER_INFO } from "@/core/data/apiRoutes"; +import {USER_INFO} from "@/core/data/apiRoutes"; import axios from "axios"; -import { createContext, useCallback, useEffect, useReducer } from "react"; +import {createContext, useCallback, useEffect, useReducer} from "react"; const initialUser = { - isAuth: false, - userChangedLanguage: false, - token: null, - user: {}, + isAuth: false, + userChangedLanguage: false, + token: null, + user: {}, }; const reducer = (state, action) => { - switch (action.type) { - case "CLEAR_USER": - return { ...state, user: {} }; - case "CHANGE_USER": - return { ...state, user: action.user }; - case "CHANGE_USER_LANGUAGE": - return { - ...state, - user: { ...state.user, user_language: action.language }, - }; - case "CHANGE_AUTH_STATE": - return { ...state, isAuth: action.isAuth }; - case "CHANGE_LANGUAGE_STATE": - return { ...state, userChangedLanguage: action.userChangedLanguage }; - case "CLEAR_TOKEN": - localStorage.removeItem("_token"); - return { ...state, token: null }; - case "SET_TOKEN": - localStorage.setItem("_token", action.token); - return { ...state, token: action.token }; - default: - return state; - } + switch (action.type) { + case "CLEAR_USER": + return {...state, user: {}}; + case "CHANGE_USER": + return {...state, user: action.user}; + case "CHANGE_USER_LANGUAGE": + return { + ...state, + user: {...state.user, user_language: action.language}, + }; + case "CHANGE_AUTH_STATE": + return {...state, isAuth: action.isAuth}; + case "CHANGE_LANGUAGE_STATE": + return {...state, userChangedLanguage: action.userChangedLanguage}; + case "CLEAR_TOKEN": + localStorage.removeItem("_token"); + return {...state, token: null}; + case "SET_TOKEN": + localStorage.setItem("_token", action.token); + return {...state, token: action.token}; + default: + return state; + } }; export const UserContext = createContext(); -export const UserProvider = ({ children }) => { - const [state, dispatch] = useReducer(reducer, initialUser); +export const UserProvider = ({children}) => { + const [state, dispatch] = useReducer(reducer, initialUser); - const clearUser = useCallback(() => { - dispatch({ type: "CLEAR_USER" }); - }, []); + const clearUser = useCallback(() => { + dispatch({type: "CLEAR_USER"}); + }, []); - const changeUser = useCallback((user) => { - dispatch({ type: "CHANGE_USER", user }); - }, []); + const changeUser = useCallback((user) => { + dispatch({type: "CHANGE_USER", user}); + }, []); - const changeUserLanguage = useCallback(/* for multi language app */); + const changeUserLanguage = useCallback(/* for multi language app */); - const changeAuthState = useCallback((isAuth) => { - dispatch({ type: "CHANGE_AUTH_STATE", isAuth }); - }, []); + const changeAuthState = useCallback((isAuth) => { + dispatch({type: "CHANGE_AUTH_STATE", isAuth}); + }, []); - const changeLanguageState = useCallback((userChangedLanguage) => { - dispatch({ type: "CHANGE_LANGUAGE_STATE", userChangedLanguage }); - }, []); + const changeLanguageState = useCallback((userChangedLanguage) => { + dispatch({type: "CHANGE_LANGUAGE_STATE", userChangedLanguage}); + }, []); - const clearToken = useCallback(() => { - dispatch({ type: "CLEAR_TOKEN" }); - }, []); + const clearToken = useCallback(() => { + dispatch({type: "CLEAR_TOKEN"}); + }, []); - const setToken = useCallback((token) => { - dispatch({ type: "SET_TOKEN", token }); - }, []); + const setToken = useCallback((token) => { + dispatch({type: "SET_TOKEN", token}); + }, []); - const getUser = useCallback( - (callback = () => {}) => { - axios - .get(USER_INFO, { - headers: { authorization: `Bearer ${state.token}` }, - }) - .then(({ data }) => { - if (typeof callback === "function") callback(data); + const getUser = useCallback( + (callback = () => { + }) => { + axios + .get(USER_INFO, { + headers: {authorization: `Bearer ${state.token}`}, + }) + .then(({data}) => { + if (typeof callback === "function") callback(data); + }); + }, + [state.token] + ); + + useEffect(() => { + const localToken = localStorage.getItem("_token"); + if (localToken) dispatch({type: "SET_TOKEN", token: localToken}); + }, []); + + useEffect(() => { + if (!state.token) { + clearUser(); + changeAuthState(false); + changeLanguageState(false); + return; + } + getUser((data) => { + changeUser(data); + changeAuthState(true); + changeLanguageState(true); }); - }, - [state.token] - ); + }, [state.token]); - useEffect(() => { - const localToken = localStorage.getItem("_token"); - if (localToken) dispatch({ type: "SET_TOKEN", token: localToken }); - }, []); - - useEffect(() => { - if (!state.token) { - clearUser(); - changeAuthState(false); - changeLanguageState(false); - return; - } - getUser((data) => { - changeUser(data); - changeAuthState(true); - changeLanguageState(true); - }); - }, [state.token]); - - return ( - - {children} - - ); + return ( + + {children} + + ); }; diff --git a/src/lib/app/hooks/useDirection.jsx b/src/lib/app/hooks/useDirection.jsx index e45cb24..b2e01fe 100644 --- a/src/lib/app/hooks/useDirection.jsx +++ b/src/lib/app/hooks/useDirection.jsx @@ -1,10 +1,10 @@ -import { useContext } from "react"; -import { LanguageContext } from "../contexts/language"; +import {useContext} from "react"; +import {LanguageContext} from "../contexts/language"; const useDirection = () => { - const { directionApp } = useContext(LanguageContext); + const {directionApp} = useContext(LanguageContext); - return { directionApp }; + return {directionApp}; }; export default useDirection; diff --git a/src/lib/app/hooks/useLanguage.jsx b/src/lib/app/hooks/useLanguage.jsx index 66e2ee0..d663835 100644 --- a/src/lib/app/hooks/useLanguage.jsx +++ b/src/lib/app/hooks/useLanguage.jsx @@ -1,28 +1,28 @@ -import { useContext } from "react"; -import { LanguageContext } from "../contexts/language"; +import {useContext} from "react"; +import {LanguageContext} from "../contexts/language"; import useUser from "./useUser"; const useLanguage = () => { - const { isAuth, changeUserLanguage } = useUser(); - const { - languageApp, - setLanguageApp, - languageIsReady, - setLanguageIsReady, - languageList, - } = useContext(LanguageContext); + const {isAuth, changeUserLanguage} = useUser(); + const { + languageApp, + setLanguageApp, + languageIsReady, + setLanguageIsReady, + languageList, + } = useContext(LanguageContext); - const changeLanguage = (lang) => { - if (lang == languageApp) return; + const changeLanguage = (lang) => { + if (lang == languageApp) return; - setLanguageIsReady(false); - setLanguageApp(lang); - if (isAuth) { - changeUserLanguage(lang); - } - }; + setLanguageIsReady(false); + setLanguageApp(lang); + if (isAuth) { + changeUserLanguage(lang); + } + }; - return { languageApp, changeLanguage, languageIsReady, languageList }; + return {languageApp, changeLanguage, languageIsReady, languageList}; }; export default useLanguage; diff --git a/src/lib/app/hooks/useLoading.jsx b/src/lib/app/hooks/useLoading.jsx index d74a87e..a691bd7 100644 --- a/src/lib/app/hooks/useLoading.jsx +++ b/src/lib/app/hooks/useLoading.jsx @@ -1,10 +1,10 @@ -import { useContext } from "react"; -import { LoadingContext } from "../contexts/loading"; +import {useContext} from "react"; +import {LoadingContext} from "../contexts/loading"; const useLoading = () => { - const { setLoadingPage } = useContext(LoadingContext); + const {setLoadingPage} = useContext(LoadingContext); - return { setLoadingPage }; + return {setLoadingPage}; }; export default useLoading; diff --git a/src/lib/app/hooks/useUser.jsx b/src/lib/app/hooks/useUser.jsx index baa0aaa..21ccbdb 100644 --- a/src/lib/app/hooks/useUser.jsx +++ b/src/lib/app/hooks/useUser.jsx @@ -1,36 +1,36 @@ -import { useContext } from "react"; -import { UserContext } from "../contexts/user"; +import {useContext} from "react"; +import {UserContext} from "../contexts/user"; const useUser = () => { - const { - isAuth, - userChangedLanguage, - token, - user, - getUser, - clearUser, - changeUser, - changeUserLanguage, - changeAuthState, - changeLanguageState, - clearToken, - setToken, - } = useContext(UserContext); + const { + isAuth, + userChangedLanguage, + token, + user, + getUser, + clearUser, + changeUser, + changeUserLanguage, + changeAuthState, + changeLanguageState, + clearToken, + setToken, + } = useContext(UserContext); - return { - isAuth, - userChangedLanguage, - token, - user, - getUser, - clearUser, - changeUser, - changeUserLanguage, - changeAuthState, - changeLanguageState, - clearToken, - setToken, - }; + return { + isAuth, + userChangedLanguage, + token, + user, + getUser, + clearUser, + changeUser, + changeUserLanguage, + changeAuthState, + changeLanguageState, + clearToken, + setToken, + }; }; export default useUser; diff --git a/src/middlewares/WithAuth.jsx b/src/middlewares/WithAuth.jsx index 5ce8831..d8a6bba 100644 --- a/src/middlewares/WithAuth.jsx +++ b/src/middlewares/WithAuth.jsx @@ -1,41 +1,41 @@ -import { NextLinkComposed } from "@/core/components/LinkRouting"; +import {NextLinkComposed} from "@/core/components/LinkRouting"; import Message from "@/core/components/Messages"; import useUser from "@/lib/app/hooks/useUser"; -import { Button, Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; -import { useRouter } from "next/router"; +import {Button, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useRouter} from "next/router"; -const WithAuthMiddleware = ({ children }) => { - const { isAuth } = useUser(); - const t = useTranslations(); - const router = useRouter(); +const WithAuthMiddleware = ({children}) => { + const {isAuth} = useUser(); + const t = useTranslations(); + const router = useRouter(); - if (!isAuth) - return ( - - {t( - "Authorization.typography_your_access_to_this_page_has_expired_Please_login_again" - )} - - } - actions={ - <> - - - } - /> - ); - return <>{children}; + if (!isAuth) + return ( + + {t( + "Authorization.typography_your_access_to_this_page_has_expired_Please_login_again" + )} + + } + actions={ + <> + + + } + /> + ); + return <>{children}; }; export default WithAuthMiddleware; diff --git a/src/middlewares/WithoutAuth.jsx b/src/middlewares/WithoutAuth.jsx index cb8e571..594ffc5 100644 --- a/src/middlewares/WithoutAuth.jsx +++ b/src/middlewares/WithoutAuth.jsx @@ -1,56 +1,56 @@ import Message from "@/core/components/Messages"; import useUser from "@/lib/app/hooks/useUser"; -import { Stack, Typography } from "@mui/material"; -import { useTranslations } from "next-intl"; -import { useSearchParams } from "next/navigation"; -import { useRouter } from "next/router"; -import { useEffect } from "react"; +import {Stack, Typography} from "@mui/material"; +import {useTranslations} from "next-intl"; +import {useSearchParams} from "next/navigation"; +import {useRouter} from "next/router"; +import {useEffect} from "react"; -const WithoutAuthMiddleware = ({ children }) => { - const { isAuth } = useUser(); - const t = useTranslations(); - const router = useRouter(); +const WithoutAuthMiddleware = ({children}) => { + const {isAuth} = useUser(); + const t = useTranslations(); + const router = useRouter(); - // gettin url query - const searchParams = useSearchParams(); - const backUrlDecodedPath = searchParams.get("back_url"); + // gettin url query + const searchParams = useSearchParams(); + const backUrlDecodedPath = searchParams.get("back_url"); - useEffect(() => { - if (!isAuth) return; - const timer = setTimeout(() => { - router.replace( - backUrlDecodedPath - ? decodeURIComponent(backUrlDecodedPath) - : "/dashboard" - ); - }, 2000); + useEffect(() => { + if (!isAuth) return; + const timer = setTimeout(() => { + router.replace( + backUrlDecodedPath + ? decodeURIComponent(backUrlDecodedPath) + : "/dashboard" + ); + }, 2000); - return () => { - clearTimeout(timer); - }; - }, [isAuth]); + return () => { + clearTimeout(timer); + }; + }, [isAuth]); - if (isAuth) - return ( - - - {t( - "Authorization.typography_your_login_is_valid_and_you_do_not_need_to_login_again" - )} - - - {t("Authorization.typography_redirect_to")}{" "} - {backUrlDecodedPath - ? t("Authorization.typography_routing_previuos_page") - : t("Authorization.typography_routing_dashbaord_page")} - - - } - /> - ); - return <>{children}; + if (isAuth) + return ( + + + {t( + "Authorization.typography_your_login_is_valid_and_you_do_not_need_to_login_again" + )} + + + {t("Authorization.typography_redirect_to")}{" "} + {backUrlDecodedPath + ? t("Authorization.typography_routing_previuos_page") + : t("Authorization.typography_routing_dashbaord_page")} + + + } + /> + ); + return <>{children}; }; export default WithoutAuthMiddleware; diff --git a/src/pages/404.jsx b/src/pages/404.jsx index 9b75470..af810b6 100644 --- a/src/pages/404.jsx +++ b/src/pages/404.jsx @@ -2,12 +2,12 @@ import NotFoundComponent from "@/components/not-found"; import Head from "next/head"; export default function NotFound() { - return ( - <> - - یافت نشد - - - - ); + return ( + <> + + یافت نشد + + + + ); } diff --git a/src/pages/_app.jsx b/src/pages/_app.jsx index be5d828..573bef2 100644 --- a/src/pages/_app.jsx +++ b/src/pages/_app.jsx @@ -1,30 +1,30 @@ import "&/fontiran.scss"; import AppLayout from "@/layouts/AppLayout"; import MuiLayout from "@/layouts/MuiLayout"; -import { LanguageProvider } from "@/lib/app/contexts/language"; -import { LoadingProvider } from "@/lib/app/contexts/loading"; -import { UserProvider } from "@/lib/app/contexts/user"; +import {LanguageProvider} from "@/lib/app/contexts/language"; +import {LoadingProvider} from "@/lib/app/contexts/loading"; +import {UserProvider} from "@/lib/app/contexts/user"; import "moment/locale/fa"; -import { NextIntlProvider } from "next-intl"; +import {NextIntlProvider} from "next-intl"; -const App = ({ Component, pageProps }) => { - return ( - <> - - - - - - - - - - - - - - - ); +const App = ({Component, pageProps}) => { + return ( + <> + + + + + + + + + + + + + + + ); }; export default App; diff --git a/src/pages/_document.jsx b/src/pages/_document.jsx index e763884..f71303f 100644 --- a/src/pages/_document.jsx +++ b/src/pages/_document.jsx @@ -1,67 +1,65 @@ -import { - createEmotionCacheLtr -} from "@/core/utils/createEmotionCache"; +import {createEmotionCacheLtr} from "@/core/utils/createEmotionCache"; import theme from "@/core/utils/theme"; import createEmotionServer from "@emotion/server/create-instance"; -import Document, { Head, Html, Main, NextScript } from "next/document"; +import Document, {Head, Html, Main, NextScript} from "next/document"; export default function MyDocument(props) { - const { emotionStyleTags } = props; + const {emotionStyleTags} = props; - return ( - - - - - - - - {emotionStyleTags} - - -
- - - - ); + return ( + + + + + + + + {emotionStyleTags} + + +
+ + + + ); } MyDocument.getInitialProps = async (ctx) => { - const originalRenderPage = ctx.renderPage; - let cache; - switch (ctx.locale) { - case "fa": - cache = createEmotionCacheLtr(); - break; - } + const originalRenderPage = ctx.renderPage; + let cache; + switch (ctx.locale) { + case "fa": + cache = createEmotionCacheLtr(); + break; + } - const { extractCriticalToChunks } = createEmotionServer(cache); + const {extractCriticalToChunks} = createEmotionServer(cache); - ctx.renderPage = () => - originalRenderPage({ - enhanceApp: (App) => - function EnhanceApp(props) { - return ; - }, - }); + ctx.renderPage = () => + originalRenderPage({ + enhanceApp: (App) => + function EnhanceApp(props) { + return ; + }, + }); - const initialProps = await Document.getInitialProps(ctx); + const initialProps = await Document.getInitialProps(ctx); - const emotionStyles = extractCriticalToChunks(initialProps.html); - const emotionStyleTags = emotionStyles.styles.map((style) => ( -