Skip to content

Commit

Permalink
Merge pull request #137 from egovernments/audit_fix_1
Browse files Browse the repository at this point in the history
Updated button, alert card and back button stories
  • Loading branch information
naveen-egov authored Oct 15, 2024
2 parents d69cf21 + f68f295 commit 2d85ec2
Show file tree
Hide file tree
Showing 8 changed files with 433 additions and 132 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"message": "Browse in my files",
"module": "core-common-component"
},
{"code": "PRIVACY_HEADER","message":" Privacy Policy for Admin Console","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER","message":" Privacy Policy","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER_1_SUB_1","message":"Introduction","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "DIGIT_TABLE_OF_CONTENTS","message":"Table of Contents","module":"digit-privacy-policy","locale":"en_MZ"},
{"code": "PRIVACY_HEADER_1_SUB_1_DESC_1","message":"This is the Privacy Policy for Admin Console","module":"digit-privacy-policy","locale":"en_MZ"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,52 @@ class IframeWidget extends StatelessWidget {
'''
(function() {
try {
// Find the tab list element
// Find the main content element
var mainContent = document.querySelector('.flex-1.relative.py-8.lg\\:px-12.break-anywhere.page-api-block\\:xl\\:max-2xl\\:pr-0.page-api-block\\:max-w-\\[1654px\\].page-api-block\\:mx-auto');
if (mainContent) {
// Remove all other elements from the body except the main content
var allChildren = Array.from(document.body.children);
allChildren.forEach(function(child) {
if (child !== mainContent) {
child.parentNode.removeChild(child);
}
});
console.log('Main content displayed, all other content removed.');
} else {
console.log('Main content not found, showing default content.');
}
// Tab switching logic
var tabList = document.querySelector('.group\\/tabs');
if (tabList) {
// Find all buttons inside the tab list
var buttons = tabList.querySelectorAll('button');
// If there are at least two buttons, switch the active class to the second button
if (buttons.length > 1) {
var firstButton = buttons[0];
var secondButton = buttons[1];
// Remove active class from the first button
if (firstButton.classList.contains('active-tab')) {
firstButton.classList.remove('active-tab');
}
// Add active class to the second button
if (!secondButton.classList.contains('active-tab')) {
secondButton.classList.add('active-tab');
}
// Optionally, trigger a click event on the second tab to ensure content loads
secondButton.click();
secondButton.click(); // Trigger content load for the second tab
console.log('Switched to second tab.');
} else {
console.log('Fallback: Only one button or no buttons found.');
}
} else {
console.log('Fallback: Tab list not found. Showing default content.');
}
} catch (error) {
console.error('Error occurred while switching tabs:', error);
console.error('Error occurred while processing the iframe content:', error);
}
})();
''',
Expand Down
6 changes: 3 additions & 3 deletions flutter/digit-ui-components/storybook/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
themeMode: ThemeMode.light,
theme: DigitExtendedTheme.instance.getLightTheme(),
darkTheme: DigitExtendedTheme.instance.getDarkTheme(),
locale: Locale("en", "MZ"),
Expand Down Expand Up @@ -133,7 +134,6 @@ class MyHomePageState extends State<MyHomePage> {
currentLocale: Locale("en", "MZ"), // Set the initial locale correctly
supportedLocales: {
"English": Locale.fromSubtags(languageCode: 'en', countryCode: 'MZ'),
"English (French)": Locale.fromSubtags(languageCode: 'en', countryCode: 'FR'),
},
delegates: [
DefaultMaterialLocalizations.delegate,
Expand Down Expand Up @@ -169,17 +169,17 @@ class MyHomePageState extends State<MyHomePage> {
...typographyStories(),
...accordionStories(),
...actionStories(),
...infoCardStories(),
...digitBackButtonStories(),
...DigitBreadCrumbStories(),
...DigitButtonStories(),
...buttonStories(),
...digitButtonListStories(),
...checkboxStories(),
...chipStories(),
...dividerStories(),
...dropdownStories(),
...fileUploaderStories(),
...inputFieldStories(),
...infoCardStories(),
...listViewStories(),
...loaderStories(),
...matrixCardStories(),
Expand Down
Loading

0 comments on commit 2d85ec2

Please sign in to comment.