diff --git a/Peregrine/Base.lproj/Main.storyboard b/Peregrine/Base.lproj/Main.storyboard index 897e2c4..585b390 100644 --- a/Peregrine/Base.lproj/Main.storyboard +++ b/Peregrine/Base.lproj/Main.storyboard @@ -229,7 +229,7 @@ - + diff --git a/Peregrine/Data/Constants.swift b/Peregrine/Data/Constants.swift index f6c46d1..6fea0e6 100644 --- a/Peregrine/Data/Constants.swift +++ b/Peregrine/Data/Constants.swift @@ -43,7 +43,8 @@ struct Labels { static let panel = "Choose a file" static let notLoggedIn = "Please Log In First 😊" static let gist = "Create Gist" - static let noText = "Write Anything 🖋" + static let noText = "Start Writing Above 🖋" + static let noLinks = "Gists will appear here 👻" } struct Errors { diff --git a/Peregrine/ViewController/GistViewController.swift b/Peregrine/ViewController/GistViewController.swift index a04c657..e9653c1 100644 --- a/Peregrine/ViewController/GistViewController.swift +++ b/Peregrine/ViewController/GistViewController.swift @@ -58,6 +58,7 @@ class GistViewController: NSViewController { self.usernameButton.title = Labels.logIn self.gistButton.title = Labels.notLoggedIn + // This is correct, it loads from default first if self.loggedIn { login() } diff --git a/Peregrine/ViewController/TableViewController.swift b/Peregrine/ViewController/TableViewController.swift index 78f36c9..5135090 100644 --- a/Peregrine/ViewController/TableViewController.swift +++ b/Peregrine/ViewController/TableViewController.swift @@ -5,6 +5,7 @@ class TableViewController: NSViewController, NSTableViewDelegate, NSTableViewDat @IBOutlet weak var scrollView: NSScrollView! var links: [Link] = [] + var noLinks: NSTextField! override func viewDidLoad() { super.viewDidLoad() @@ -22,6 +23,13 @@ class TableViewController: NSViewController, NSTableViewDelegate, NSTableViewDat self.links = UserDefaults.standard.getList(key: UserDefaults.Key.links) tableView.reloadData() + if self.links.count == 0 { + if #available(OSX 10.12, *) { + noLinks = NSTextField(labelWithAttributedString: NSAttributedString.create(color: .white, size: 20, title: Labels.noLinks, alignment: .center)) + self.view.addSubview(noLinks) + } + } + NotificationCenter.default.addObserver(self, selector: #selector(self.addTableViewItem(_:)), name: .AddItem, object: nil) } @@ -65,6 +73,10 @@ class TableViewController: NSViewController, NSTableViewDelegate, NSTableViewDat self.links = UserDefaults.standard.getList(key: UserDefaults.Key.links) tableView.reloadData() tableView.scrollRowToVisible(0) + if self.links.count > 0 && noLinks != nil { + self.noLinks.removeFromSuperview() + self.noLinks = nil + } DispatchQueue.main.asyncAfter(deadline: .now() + 0.1) { self.tableView.rowView(atRow: 0, makeIfNecessary: false)?.isSelected = true }