Skip to content

Commit

Permalink
JNG-4734 fix react issues (#52)
Browse files Browse the repository at this point in the history
* JNG-4734 fix react issues

* JNG-4734 fix icon issues and mui translation causing runtime crashes

* JNG-4734 fix date-time handling
  • Loading branch information
noherczeg authored Apr 12, 2023
1 parent 5e6e9de commit 6f5eae7
Show file tree
Hide file tree
Showing 19 changed files with 173 additions and 106 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -154,8 +154,8 @@ public static String getMuiMaterialImportsForActionForm(PageDefinition pageDefin
return String.join(", ", imports).concat(imports.size() > 0 ? "," : "");
}

public static SortedSet<String> getUniqueVisualElementNamesForPage(PageDefinition pageDefinition) {
Set<VisualElement> flattenedVisualElements = createFlattenedSetOfVisualElements(pageDefinition);
public static SortedSet<String>getUniqueVisualElementNamesForPage(PageDefinition pageDefinition) {
SortedSet<VisualElement> flattenedVisualElements = createFlattenedSetOfVisualElements(pageDefinition);
SortedSet<String> uniqueVisualElementNames = new TreeSet<>();

flattenedVisualElements.forEach(v -> uniqueVisualElementNames.add(getVisualElementWidgetName(v)));
Expand All @@ -171,16 +171,16 @@ public static String getVisualElementWidgetName(VisualElement visualElement) {
return visualElement.eClass().getInstanceClass().getSimpleName();
}

public static Set<VisualElement> createFlattenedSetOfVisualElements(PageDefinition pageDefinition) {
Set<VisualElement> flattenedVisualElements = new HashSet<>();
public static SortedSet<VisualElement> createFlattenedSetOfVisualElements(PageDefinition pageDefinition) {
SortedSet<VisualElement> flattenedVisualElements = new TreeSet<>(Comparator.comparing((VisualElement v) -> v.getFQName().trim()));
Container container = pageDefinition.getContainers().get(0);

fillFlattenedVisualElements(container, flattenedVisualElements);

return flattenedVisualElements;
}

public static void fillFlattenedVisualElements(Container container, Set<VisualElement> elements) {
public static void fillFlattenedVisualElements(Container container, SortedSet<VisualElement> elements) {
List<VisualElement> contents = container.getChildren();

elements.addAll(contents);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import lombok.extern.java.Log;
import org.springframework.util.StringUtils;

import java.util.Set;
import java.util.*;
import java.util.stream.Collectors;

import static hu.blackbelt.judo.ui.generator.react.UiImportHelper.createFlattenedSetOfVisualElements;
Expand All @@ -39,9 +39,15 @@ public static String camelCaseNameToInterfaceKey(String name) {
return name.replaceAll("([a-z])([A-Z]+)", "$1_$2").toUpperCase();
}

public static Set<VisualElement> getVisualElementsWithCustomImplementation(PageDefinition pageDefinition) {
return createFlattenedSetOfVisualElements(pageDefinition).stream()
public static SortedSet<VisualElement> getVisualElementsWithCustomImplementation(PageDefinition pageDefinition) {
Set<VisualElement> visualElements = createFlattenedSetOfVisualElements(pageDefinition).stream()
.filter(VisualElement::isCustomImplementation).collect(Collectors.toSet());

SortedSet<VisualElement> result = new TreeSet<>(Comparator.comparing((VisualElement v) -> v.getFQName().trim()));

result.addAll(visualElements);

return result;
}

public static String getCustomizationComponentInterface(VisualElement element) {
Expand Down
2 changes: 1 addition & 1 deletion judo-ui-react/src/main/resources/actor/README.md.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This application has been generated by the JUDO toolbox.
## Scripts

- `pnpm run dev`: recommended for local development (watch + dev-server + Hot reload)
- `pnpm run build:dev`: production build without type checking
- `pnpm run build`: development build without type checking
- `pnpm run build:ci`: full-blown production build
- `pnpm run preview`: starts a dev server serving content from `dist/`

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,15 @@
"@emotion/styled": "11.10.5",
"@fontsource/roboto": "4.5.8",
"@mdi/font": "7.1.96",
"@mui/material": "5.11.4",
"@mui/x-data-grid": "5.17.18",
"@mui/x-date-pickers": "5.0.13",
"@mui/material": "5.11.16",
"@mui/x-data-grid": "5.17.26",
"@mui/x-date-pickers": "5.0.20",
"@pandino/loader-configuration-dom": "0.8.27",
"@pandino/pandino": "0.8.27",
"@pandino/react-hooks": "0.8.27",
"@remix-run/router": "1.5.0",
"axios": "1.2.1",
"dayjs": "1.11.7",
"date-fns": "2.29.3",
"i18next": "22.4.6",
"notistack": "3.0.1",
"oidc-client-ts": "2.2.1",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"dev": "vite",
"build:dev": "vite build",
"build": "vite build",
"build:ci": "tsc && vite build",
"preview": "vite preview",
"format": "prettier --config .prettierrc \"src/**/*.{js,jsx,ts,tsx}\" --write --loglevel error"
Loading

0 comments on commit 6f5eae7

Please sign in to comment.