Commit 579f896f authored by Wei Han's avatar Wei Han

UI update

parent 57f82def
...@@ -8,32 +8,32 @@ ...@@ -8,32 +8,32 @@
<key>BinaryPath</key> <key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string> <string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key> <key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string> <string>ios-arm64</string>
<key>LibraryPath</key> <key>LibraryPath</key>
<string>QmsPluginFramework.framework</string> <string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key> <key>SupportedArchitectures</key>
<array> <array>
<string>arm64</string> <string>arm64</string>
<string>x86_64</string>
</array> </array>
<key>SupportedPlatform</key> <key>SupportedPlatform</key>
<string>ios</string> <string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict> </dict>
<dict> <dict>
<key>BinaryPath</key> <key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string> <string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key> <key>LibraryIdentifier</key>
<string>ios-arm64</string> <string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key> <key>LibraryPath</key>
<string>QmsPluginFramework.framework</string> <string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key> <key>SupportedArchitectures</key>
<array> <array>
<string>arm64</string> <string>arm64</string>
<string>x86_64</string>
</array> </array>
<key>SupportedPlatform</key> <key>SupportedPlatform</key>
<string>ios</string> <string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict> </dict>
</array> </array>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
......
// AddIssueViewController.h
#import <UIKit/UIKit.h>
@interface AddIssueViewController : UIViewController
@end
// AddIssueViewController.mm
#import "AddIssueViewController.h"
@implementation AddIssueViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = [UIColor whiteColor];
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(20, 100, self.view.bounds.size.width - 40, 40)];
title.text = @"Add Issue Page";
title.textAlignment = NSTextAlignmentCenter;
title.font = [UIFont boldSystemFontOfSize:22];
[self.view addSubview:title];
UIButton *closeButton = [UIButton buttonWithType:UIButtonTypeSystem];
closeButton.frame = CGRectMake(20, 40, 80, 40);
[closeButton setTitle:@"Close" forState:UIControlStateNormal];
[closeButton addTarget:self action:@selector(closeTapped) forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:closeButton];
}
- (void)closeTapped {
[self dismissViewControllerAnimated:YES completion:nil];
}
@end
// DetailsViewController.h
// AddIssueDetailsViewController.h
#import <UIKit/UIKit.h>
@interface AddIssueDetailsViewController : UIViewController
@end
// DetailsViewController.mm
#import "DetailsViewController.h"
@interface AddIssueDetailsViewController ()
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UITextField *locationField;
@property (nonatomic, strong) UITextView *commentField;
@property (nonatomic, strong) UIButton *submitButton;
@end
@implementation AddIssueDetailsViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
[self setupHeader];
[self setupForm];
}
- (void)setupHeader {
CGFloat topInset = self.view.safeAreaInsets.top;
UIView *header = [[UIView alloc] initWithFrame:CGRectMake(0, topInset, self.view.bounds.size.width, 48)];
header.backgroundColor = [UIColor colorWithRed:0/255.0 green:109/255.0 blue:141/255.0 alpha:1];
header.autoresizingMask = UIViewAutoresizingFlexibleWidth;
[self.view addSubview:header];
UILabel *title = [[UILabel alloc] initWithFrame:CGRectMake(0, 8, header.bounds.size.width, 32)];
title.text = @"Add Issue Details";
title.textColor = UIColor.whiteColor;
title.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
title.textAlignment = NSTextAlignmentCenter;
[header addSubview:title];
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom];
backButton.frame = CGRectMake(12, 8, 32, 32);
[backButton setImage:[UIImage imageNamed:@"back24"] forState:UIControlStateNormal];
[backButton addTarget:self action:@selector(dismissSelf) forControlEvents:UIControlEventTouchUpInside];
[header addSubview:backButton];
}
- (void)setupForm {
CGFloat topInset = self.view.safeAreaInsets.top + 48;
self.scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, topInset, self.view.bounds.size.width, self.view.bounds.size.height - topInset)];
[self.view addSubview:self.scrollView];
UILabel *locationLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 200, 20)];
locationLabel.text = @"*Location";
locationLabel.font = [UIFont boldSystemFontOfSize:16];
[self.scrollView addSubview:locationLabel];
self.locationField = [[UITextField alloc] initWithFrame:CGRectMake(20, 50, self.view.bounds.size.width - 40, 40)];
self.locationField.borderStyle = UITextBorderStyleRoundedRect;
[self.scrollView addSubview:self.locationField];
UILabel *commentLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 110, 200, 20)];
commentLabel.text = @"Comment";
commentLabel.font = [UIFont boldSystemFontOfSize:16];
[self.scrollView addSubview:commentLabel];
self.commentField = [[UITextView alloc] initWithFrame:CGRectMake(20, 140, self.view.bounds.size.width - 40, 100)];
self.commentField.layer.borderColor = [UIColor lightGrayColor].CGColor;
self.commentField.layer.borderWidth = 1.0;
self.commentField.layer.cornerRadius = 8;
[self.scrollView addSubview:self.commentField];
self.submitButton = [UIButton buttonWithType:UIButtonTypeSystem];
self.submitButton.frame = CGRectMake(20, 260, self.view.bounds.size.width - 40, 48);
self.submitButton.backgroundColor = [UIColor colorWithRed:0/255.0 green:109/255.0 blue:141/255.0 alpha:1];
[self.submitButton setTitle:@"Submit" forState:UIControlStateNormal];
[self.submitButton setTitleColor:UIColor.whiteColor forState:UIControlStateNormal];
self.submitButton.layer.cornerRadius = 8;
[self.submitButton addTarget:self action:@selector(handleSubmit) forControlEvents:UIControlEventTouchUpInside];
[self.scrollView addSubview:self.submitButton];
}
- (void)dismissSelf {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)handleSubmit {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Submitted"
message:@"Issue has been added (mock)."
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
@end
// PlanViewController.h
#import <UIKit/UIKit.h>
NS_ASSUME_NONNULL_BEGIN
@interface PlanViewController : UIViewController
@end
NS_ASSUME_NONNULL_END
// PlanViewController.mm
#import "PlanViewController.h"
#import "DetailsViewController.h"
@interface PlanViewController ()
@property (nonatomic, strong) UIView *headerView;
@property (nonatomic, strong) UILabel *titleLabel;
@property (nonatomic, strong) UIButton *backButton;
@property (nonatomic, strong) UIButton *helpButton;
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIImageView *planImageView;
@end
@implementation PlanViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.view.backgroundColor = UIColor.whiteColor;
NSLog(@"PlanViewController loaded");
// Create UI elements (but don’t assign final frames yet)
[self createHeader];
[self createScrollView];
}
- (void)viewDidLayoutSubviews {
[super viewDidLayoutSubviews];
// Get safe area + bounds
CGFloat topInset = self.view.safeAreaInsets.top;
CGFloat headerHeight = 48.0;
// Layout header
self.headerView.frame = CGRectMake(0, topInset, self.view.bounds.size.width, headerHeight);
// Layout title
self.titleLabel.frame = CGRectMake(0, 8, self.headerView.bounds.size.width, 32);
self.helpButton.frame = CGRectMake(self.headerView.bounds.size.width - 44, 8, 32, 32);
self.backButton.frame = CGRectMake(12, 8, 32, 32);
// Layout scroll view
CGFloat scrollY = topInset + headerHeight;
self.scrollView.frame = CGRectMake(0, scrollY, self.view.bounds.size.width,
self.view.bounds.size.height - scrollY);
self.planImageView.frame = self.scrollView.bounds;
// Make absolutely sure header is above scroll view
[self.view bringSubviewToFront:self.headerView];
}
#pragma mark - UI Creation
- (void)createHeader {
self.headerView = [[UIView alloc] init];
self.headerView.backgroundColor = [UIColor colorWithRed:0/255.0 green:109/255.0 blue:141/255.0 alpha:1];
[self.view addSubview:self.headerView];
// Back button
self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.backButton setImage:[UIImage imageNamed:@"back24"] forState:UIControlStateNormal];
[self.backButton addTarget:self action:@selector(handleBack) forControlEvents:UIControlEventTouchUpInside];
[self.headerView addSubview:self.backButton];
// Title
self.titleLabel = [[UILabel alloc] init];
self.titleLabel.text = @"Plan Viewer";
self.titleLabel.textColor = UIColor.whiteColor;
self.titleLabel.font = [UIFont systemFontOfSize:18 weight:UIFontWeightMedium];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
[self.headerView addSubview:self.titleLabel];
// Help button
self.helpButton = [UIButton buttonWithType:UIButtonTypeCustom];
[self.helpButton setImage:[UIImage imageNamed:@"btn_white_help_3x"] forState:UIControlStateNormal];
[self.helpButton addTarget:self action:@selector(showTutorial) forControlEvents:UIControlEventTouchUpInside];
[self.headerView addSubview:self.helpButton];
}
- (void)createScrollView {
self.scrollView = [[UIScrollView alloc] init];
self.scrollView.delegate = (id<UIScrollViewDelegate>)self;
self.scrollView.minimumZoomScale = 1.0;
self.scrollView.maximumZoomScale = 5.0;
[self.view addSubview:self.scrollView];
self.planImageView = [[UIImageView alloc] init];
self.planImageView.contentMode = UIViewContentModeScaleAspectFit;
[self.scrollView addSubview:self.planImageView];
UIImage *testImage = [UIImage imageNamed:@"image_placeholder"];
if (!testImage) {
NSLog(@"❌ image_placeholder not found in bundle!");
self.planImageView.backgroundColor = [UIColor systemTealColor];
// 👉 Temporary test button
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeSystem];
[testButton setTitle:@"Next Screen →" forState:UIControlStateNormal];
testButton.titleLabel.font = [UIFont boldSystemFontOfSize:18];
[testButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
testButton.backgroundColor = [UIColor colorWithRed:0.0 green:0.43 blue:0.55 alpha:1.0];
testButton.layer.cornerRadius = 8;
testButton.clipsToBounds = YES;
// Add simple frame — will center it later in viewDidLayoutSubviews
testButton.frame = CGRectMake(0, 0, 200, 50);
testButton.center = self.view.center;
[testButton addTarget:self
action:@selector(handleNextScreen)
forControlEvents:UIControlEventTouchUpInside];
// Add directly on top of main view (not inside scrollView)
[self.view addSubview:testButton];
} else {
self.planImageView.image = testImage;
}
}
- (void)handleNextScreen {
NSLog(@"➡️ Test button tapped — navigating to AddIssueDetailsViewController");
AddIssueDetailsViewController *nextVC = [[AddIssueDetailsViewController alloc] init];
nextVC.modalPresentationStyle = UIModalPresentationFullScreen;
[self presentViewController:nextVC animated:YES completion:nil];
}
#pragma mark - Actions
- (void)handleBack {
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)showTutorial {
UIAlertController *alert = [UIAlertController alertControllerWithTitle:@"Help"
message:@"This would show the tutorial (e.g. step1/step2/step3)."
preferredStyle:UIAlertControllerStyleAlert];
[alert addAction:[UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:nil]];
[self presentViewController:alert animated:YES completion:nil];
}
#pragma mark - UIScrollViewDelegate
- (UIView *)viewForZoomingInScrollView:(UIScrollView *)scrollView {
return self.planImageView;
}
@end
...@@ -42,12 +42,6 @@ ...@@ -42,12 +42,6 @@
[headerBar addSubview:_projectNameLabel]; [headerBar addSubview:_projectNameLabel];
// Menu button // Menu button
UIButton *menuButton = [UIButton buttonWithType:UIButtonTypeSystem];
[menuButton setTitle:@"Menu" forState:UIControlStateNormal];
[menuButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
menuButton.titleLabel.font = [UIFont boldSystemFontOfSize:16];
menuButton.translatesAutoresizingMaskIntoConstraints = NO;
[headerBar addSubview:menuButton];
// Unit name (bottom left) // Unit name (bottom left)
_unitNameLabel = [[UILabel alloc] init]; _unitNameLabel = [[UILabel alloc] init];
...@@ -74,8 +68,6 @@ ...@@ -74,8 +68,6 @@
// Back button // Back button
// Menu button // Menu button
[menuButton.trailingAnchor constraintEqualToAnchor:headerBar.trailingAnchor constant:-16],
[menuButton.centerYAnchor constraintEqualToAnchor:headerBar.centerYAnchor],
// Title centered // Title centered
[_projectNameLabel.centerXAnchor constraintEqualToAnchor:headerBar.centerXAnchor], [_projectNameLabel.centerXAnchor constraintEqualToAnchor:headerBar.centerXAnchor],
......
#import "DashboardViewController.h" #import "DashboardViewController.h"
#import "DashboardHeaderView.h" #import "DashboardHeaderView.h"
#import <CoreGraphics/CoreGraphics.h> #import <CoreGraphics/CoreGraphics.h>
#import "AddIssueViewController.h" #import "PlanViewController.h"
@implementation DashboardViewController { @implementation DashboardViewController {
DashboardHeaderView *_headerView; DashboardHeaderView *_headerView;
...@@ -30,14 +30,57 @@ ...@@ -30,14 +30,57 @@
overlayImage:[UIImage imageNamed:@"overlay"]]; overlayImage:[UIImage imageNamed:@"overlay"]];
[self.view addSubview:_headerView]; [self.view addSubview:_headerView];
// Create Back Button
UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem]; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeSystem];
backButton.frame = CGRectMake(16, 44, 60, 40); // adjust Y for safe area backButton.translatesAutoresizingMaskIntoConstraints = NO;
[backButton setImage:[UIImage systemImageNamed:@"chevron.left"] forState:UIControlStateNormal];
[backButton setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal]; UIImage *backImage = [UIImage systemImageNamed:@"chevron.left"];
backButton.titleLabel.font = [UIFont boldSystemFontOfSize:16]; backImage = [backImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[backButton addTarget:self action:@selector(handleBackButtonTapped) [backButton setImage:backImage forState:UIControlStateNormal];
backButton.tintColor = [UIColor whiteColor];
backButton.layer.cornerRadius = 18;
backButton.backgroundColor = [UIColor clearColor];
backButton.clipsToBounds = YES;
[backButton addTarget:self
action:@selector(handleBackButtonTapped)
forControlEvents:UIControlEventTouchUpInside]; forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:backButton]; [self.view addSubview:backButton];
// Create Menu Button
UIButton *menuButton = [UIButton buttonWithType:UIButtonTypeSystem];
menuButton.translatesAutoresizingMaskIntoConstraints = NO;
UIImage *menuImage = [UIImage systemImageNamed:@"line.3.horizontal"];
menuImage = [menuImage imageWithRenderingMode:UIImageRenderingModeAlwaysTemplate];
[menuButton setImage:menuImage forState:UIControlStateNormal];
menuButton.tintColor = [UIColor whiteColor];
menuButton.backgroundColor = [UIColor clearColor];
menuButton.contentEdgeInsets = UIEdgeInsetsMake(8, 8, 8, 8);
[menuButton addTarget:self
action:@selector(handleMenuButtonTapped)
forControlEvents:UIControlEventTouchUpInside];
[self.view addSubview:menuButton];
// ✅ Use Auto Layout constraints to respect safe area
[NSLayoutConstraint activateConstraints:@[
// Back button - top left
[backButton.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor constant:8],
[backButton.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:4],
[backButton.widthAnchor constraintEqualToConstant:44],
[backButton.heightAnchor constraintEqualToConstant:44],
// Menu button - top right
[menuButton.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor constant:-8],
[menuButton.topAnchor constraintEqualToAnchor:self.view.safeAreaLayoutGuide.topAnchor constant:4],
[menuButton.widthAnchor constraintEqualToConstant:44],
[menuButton.heightAnchor constraintEqualToConstant:44],
]];
} }
- (void)handleBackButtonTapped { - (void)handleBackButtonTapped {
...@@ -51,6 +94,10 @@ ...@@ -51,6 +94,10 @@
} }
} }
- (void)handleMenuButtonTapped {
NSLog(@"🍔 Menu button tapped – (TODO: open side menu or modal)");
}
#pragma mark - Footer #pragma mark - Footer
- (void)setupFooter { - (void)setupFooter {
...@@ -143,13 +190,13 @@ ...@@ -143,13 +190,13 @@
case 1: { case 1: {
// Add Issue // Add Issue
AddIssueViewController *addIssueVC = [[AddIssueViewController alloc] init]; PlanViewController *planVC = [[PlanViewController alloc] init];
addIssueVC.modalPresentationStyle = UIModalPresentationFullScreen; planVC.modalPresentationStyle = UIModalPresentationFullScreen;
if (!addIssueVC) { if (!planVC) {
NSLog(@"❌ AddIssueViewController class not found!"); NSLog(@"❌ PlanViewController class not found!");
return; return;
} }
[self presentViewController:addIssueVC animated:YES completion:nil]; [self presentViewController:planVC animated:YES completion:nil];
break; break;
} }
......
...@@ -8,32 +8,32 @@ ...@@ -8,32 +8,32 @@
<key>BinaryPath</key> <key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string> <string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key> <key>LibraryIdentifier</key>
<string>ios-arm64_x86_64-simulator</string> <string>ios-arm64</string>
<key>LibraryPath</key> <key>LibraryPath</key>
<string>QmsPluginFramework.framework</string> <string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key> <key>SupportedArchitectures</key>
<array> <array>
<string>arm64</string> <string>arm64</string>
<string>x86_64</string>
</array> </array>
<key>SupportedPlatform</key> <key>SupportedPlatform</key>
<string>ios</string> <string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict> </dict>
<dict> <dict>
<key>BinaryPath</key> <key>BinaryPath</key>
<string>QmsPluginFramework.framework/QmsPluginFramework</string> <string>QmsPluginFramework.framework/QmsPluginFramework</string>
<key>LibraryIdentifier</key> <key>LibraryIdentifier</key>
<string>ios-arm64</string> <string>ios-arm64_x86_64-simulator</string>
<key>LibraryPath</key> <key>LibraryPath</key>
<string>QmsPluginFramework.framework</string> <string>QmsPluginFramework.framework</string>
<key>SupportedArchitectures</key> <key>SupportedArchitectures</key>
<array> <array>
<string>arm64</string> <string>arm64</string>
<string>x86_64</string>
</array> </array>
<key>SupportedPlatform</key> <key>SupportedPlatform</key>
<string>ios</string> <string>ios</string>
<key>SupportedPlatformVariant</key>
<string>simulator</string>
</dict> </dict>
</array> </array>
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment