Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 32 additions & 96 deletions crow-bank-app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -341,99 +341,38 @@ string get_file_path(const string &relative_path)
string getIcon(const string &iconType)
{
#ifdef _WIN32
// Windows - Smart emoji detection
// Check for Windows Terminal or modern terminal capabilities
static bool useEmojis = []()
{
// Check environment variables that indicate modern terminal
const char *wt_session = getenv("WT_SESSION"); // Windows Terminal
const char *term_program = getenv("TERM_PROGRAM"); // VS Code terminal, etc.
const char *colorterm = getenv("COLORTERM"); // Modern terminals
const char *force_emojis = getenv("FORCE_EMOJIS"); // User override
const char *no_emojis = getenv("NO_EMOJIS"); // User disable

// User explicitly disabled emojis
if (no_emojis)
return false;

// User explicitly enabled emojis
if (force_emojis)
return true;

// Detect modern terminal environment
return (wt_session || term_program || colorterm);
}();

if (useEmojis)
{
// Unicode emojis for modern Windows terminals
if (iconType == "bank")
return "🏦";
if (iconType == "register")
return "πŸ“";
if (iconType == "login")
return "πŸ”";
if (iconType == "help")
return "❓";
if (iconType == "exit")
return "πŸšͺ";
if (iconType == "deposit")
return "πŸ’°";
if (iconType == "withdraw")
return "πŸ’Έ";
if (iconType == "balance")
return "πŸ’³";
if (iconType == "history")
return "πŸ“Š";
if (iconType == "transfer")
return "πŸ”„";
if (iconType == "settings")
return "βš™οΈ";
if (iconType == "logout")
return "πŸšͺ";
if (iconType == "success")
return "βœ…";
if (iconType == "error")
return "❌";
if (iconType == "warning")
return "⚠️";
return "β€’";
}
else
{
// Windows fallback - basic ASCII characters only
if (iconType == "bank")
return "";
if (iconType == "register")
return "";
if (iconType == "login")
return "";
if (iconType == "help")
return "";
if (iconType == "exit")
return "";
if (iconType == "deposit")
return "";
if (iconType == "withdraw")
return "";
if (iconType == "balance")
return "";
if (iconType == "history")
return "";
if (iconType == "transfer")
return "";
if (iconType == "settings")
return "";
if (iconType == "logout")
return "";
if (iconType == "success")
return "[OK]";
if (iconType == "error")
return "[ERROR]";
if (iconType == "warning")
return "[WARNING]";
// Windows - Clean text without icons for better appearance
if (iconType == "bank")
return "";
}
if (iconType == "register")
return "";
if (iconType == "login")
return "";
if (iconType == "help")
return "";
if (iconType == "exit")
return "";
if (iconType == "deposit")
return "";
if (iconType == "withdraw")
return "";
if (iconType == "balance")
return "";
if (iconType == "history")
return "";
if (iconType == "transfer")
return "";
if (iconType == "settings")
return "";
if (iconType == "logout")
return "";
if (iconType == "success")
return "[SUCCESS]";
if (iconType == "error")
return "[ERROR]";
if (iconType == "warning")
return "[WARNING]";
return "";
#else
// Linux/Unix - Unicode emojis
if (iconType == "bank")
Expand Down Expand Up @@ -929,7 +868,6 @@ string read_file(const string &filename)
// Main CLI authentication menu
void displayAuthMenu()
{
cout << "Made with <3\n\n";
cout << "==============================================\n";
cout << " " << getIcon("bank") << " SECURE BANK CLI SYSTEM \n";
cout << "==============================================\n";
Expand All @@ -945,7 +883,6 @@ void displayAuthMenu()
// Banking dashboard menu (after login)
void displayBankingMenu(const string &userName)
{
cout << "Made with <3\n\n";
cout << "==============================================\n";
cout << " " << getIcon("bank") << " WELCOME " << userName << "\n";
cout << "==============================================\n";
Expand Down Expand Up @@ -1453,7 +1390,6 @@ void runCLI()

void displayWelcomeScreen()
{
cout << "Made with <3\n\n";
cout << "========================================\n";
cout << " " << getIcon("bank") << " SECURE BANK SYSTEM \n";
cout << "========================================\n";
Expand Down Expand Up @@ -1555,7 +1491,7 @@ int main(int argc, char *argv[])
case 3:
{ // Exit
clearScreen();
cout << "\nοΏ½ Thank you for exploring SecureBank!\n";
cout << "\n" << getIcon("exit") << " Thank you for exploring SecureBank!\n";

Copilot AI Aug 1, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line will display an empty string on Windows since getIcon("exit") returns "" for Windows, resulting in inconsistent formatting. The original hardcoded symbol may have been intentional to ensure consistent display across platforms.

Suggested change
cout << "\n" << getIcon("exit") << " Thank you for exploring SecureBank!\n";
{
std::string exitIcon = getIcon("exit");
if (exitIcon.empty()) exitIcon = ">>";
cout << "\n" << exitIcon << " Thank you for exploring SecureBank!\n";
}

Copilot uses AI. Check for mistakes.

return 0;
}
Expand Down
Loading