| 1 | <div class="row mt-5"> |
| 2 | <div class="col-md-12"> |
| 3 | <%= render('partial_menus', active_menu: 'settings' ) %> |
| 4 | </div> |
| 5 | </div> |
| 6 | <div class="row mt-3"> |
| 7 | <%= render "shared/flash_message", object: flash %> |
| 8 | <ul class="list-group"> |
| 9 | <li class="list-group-item"> |
| 10 | <h4><%= t('your_invitees') %></h4> |
| 11 | <p><%= t('your_invitees_explanation') %></p> |
| 12 | <%= link_to(t('invite_button'), new_user_invitation_path, class: 'btn btn-primary', target: '__blank') %> |
| 13 | <div class="table-responsive"> |
| 14 | <table class="table table-striped"> |
| 15 | <thead> |
| 16 | <tr> |
| 17 | <th scope="col"><%= t("no") %></th> |
| 18 | <th scope="col"><%= t("your_invite_email") %></th> |
| 19 | <th scope="col"><%= t("your_invite_date") %></th> |
| 20 | <th scope="col"><%= t("your_invite_status") %></th> |
| 21 | </tr> |
| 22 | </thead> |
| 23 | <tbody> |
| 24 | <% @current_user.invitees.each_with_index do |invite, index| %> |
| 25 | <tr> |
| 26 | <th scope="row"><%= index + 1 %></th> |
| 27 | <td> |
| 28 | <%= invite.email %> |
| 29 | </td> |
| 30 | <td> |
| 31 | <%= time_ago_in_words invite.created_at %> |
| 32 | </td> |
| 33 | <td> |
| 34 | <%= invite.invitation_accepted? ? '<i class="bi bi-check"></i>'.html_safe |
| 35 | : '<i class="bi bi-send-check"></i>'.html_safe %> |
| 36 | </td> |
| 37 | </tr> |
| 38 | <% end %> |
| 39 | </tbody> |
| 40 | </table> |
| 41 | </div> |
| 42 | </li> |
| 43 | <li class="list-group-item"> |
| 44 | <h4><%= t('your_wallet_address') %></h4> |
| 45 | <p><%= t('your_wallet_address_explanation', href: link_to('Raydium', 'https://beta.raydium.io/swap/?inputMint=CTQBjyrX8pYyqbNa8vAhQfnRXfu9cUxnvrxj5PvbzTmf&outputMint=EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', target: '_blank')).html_safe %></p> |
| 46 | <div class="table-responsive"> |
| 47 | <table class="table table-striped"> |
| 48 | <thead> |
| 49 | <tr> |
| 50 | <th scope="col"><%= t("no") %></th> |
| 51 | <th scope="col"><%= t("your_wallet_pubkey") %></th> |
| 52 | <th scope="col"><%= t("your_wallet_creation_date") %></th> |
| 53 | <th scope="col"><%= t("your_wallet_type") %></th> |
| 54 | <th scope="col"><%= t("your_wallet_action") %></th> |
| 55 | </tr> |
| 56 | </thead> |
| 57 | <tbody> |
| 58 | <% @current_user.wallets.each_with_index do |wallet, index| %> |
| 59 | <tr> |
| 60 | <th scope="row"><%= index + 1 %></th> |
| 61 | <td> |
| 62 | <%= wallet.pubkey %> |
| 63 | </td> |
| 64 | <td> |
| 65 | <%= time_ago_in_words wallet.created_at %> |
| 66 | </td> |
| 67 | <td> |
| 68 | <%= wallet.wallet_type %> |
| 69 | </td> |
| 70 | <td> |
| 71 | <% if wallet.solana? %> |
| 72 | <%= link_to('Solscan', "https://solscan.io/account/#{wallet.pubkey}", target: '__blank') %> |
| 73 | <%= link_to(t('activate_solana_wallet'), settings_activate_solana_path, class: 'btn btn-primary', method: :post) if !wallet.done? %> |
| 74 | <% end %> |
| 75 | <% if wallet.evm? %> |
| 76 | <%= link_to('BscScan', "https://bscscan.com/address/#{wallet.pubkey}", target: '__blank') %> |
| 77 | <% end %> |
| 78 | </td> |
| 79 | </tr> |
| 80 | <% end %> |
| 81 | </tbody> |
| 82 | </table> |
| 83 | </div> |
| 84 | </li> |
| 85 | <li class="list-group-item"> |
| 86 | <h4><%= t('your_account_connections') %></h1> |
| 87 | <p><%= t('your_account_connections_explanation') %></p> |
| 88 | <div class="form-check form-switch mb-3"> |
| 89 | <input class="form-check-input sync-spotify" type="checkbox" <%= 'checked' if @current_user.user_setting&.sync_spotify? %>> |
| 90 | <label class="form-check-label" for="flexSwitchCheckChecked">Spotify</label> |
| 91 | </div> |
| 92 | <p><%= t('your_account_connections_spotify_token_explanation') %></p> |
| 93 | <div class="form-check form-switch mb-3"> |
| 94 | <input class="form-check-input allowed-use-spotify-token" type="checkbox" <%= 'checked' if @current_user.user_setting&.allowed_use_spotify_token? %>> |
| 95 | <label class="form-check-label" for="flexSwitchCheckChecked">Spotify Token</label> |
| 96 | </div> |
| 97 | <p><%= t('your_account_connections_google_explanation') %></p> |
| 98 | <div class="form-check form-switch mb-3"> |
| 99 | <input class="form-check-input allowed-use-google-token" type="checkbox" <%= 'checked' if @current_user.user_setting&.allowed_use_google_token? %>> |
| 100 | <label class="form-check-label" for="flexSwitchCheckChecked">Google Token</label> |
| 101 | </div> |
| 102 | <div class="alert alert-warning alert-sync" role="alert" style='display:none;'> |
| 103 | <strong>Updated!</strong>. |
| 104 | </div> |
| 105 | </li> |
| 106 | <li class="list-group-item"> |
| 107 | <h4><%= t('your_locale') %></h1> |
| 108 | <p><%= t('your_locale_explanation') %></p> |
| 109 | <script> |
| 110 | function changeDefaultLocale(locale) { |
| 111 | $.ajax({ |
| 112 | type: "POST", |
| 113 | url: "<%= settings_locale_path %>", |
| 114 | data: { authenticity_token: "<%= form_authenticity_token %>", default_locale: locale.value }, |
| 115 | success(data) { |
| 116 | location.reload(); |
| 117 | return false; |
| 118 | }, |
| 119 | error(data) { |
| 120 | alert('Something wrong. Try again later.'); |
| 121 | return false; |
| 122 | } |
| 123 | }) |
| 124 | } |
| 125 | </script> |
| 126 | <select id="select-locale" class="form-select" aria-label="Locale" onchange="changeDefaultLocale(this)"> |
| 127 | <% I18n.available_locales.each do |locale| %> |
| 128 | <option <%= 'selected' if I18n.locale == locale %> value="<%= locale_index(locale) %>"><%= t('locale_name', locale: locale) %></option> |
| 129 | <% end %> |
| 130 | </select> |
| 131 | </li> |
| 132 | </ul> |
| 133 | </div> |
| 134 | <script> |
| 135 | // Track a timeoutID |
| 136 | var timeoutID; |
| 137 | |
| 138 | function prepareUpdate() { |
| 139 | if (timeoutID) { |
| 140 | clearTimeout(timeoutID); |
| 141 | } |
| 142 | $('.alert-sync').hide(); |
| 143 | } |
| 144 | |
| 145 | function updateSettings(type, value) { |
| 146 | $.ajax({ |
| 147 | method: 'PUT', |
| 148 | url: '<%= update_settings_path %>', |
| 149 | data: { |
| 150 | authenticity_token: '<%= form_authenticity_token %>', |
| 151 | settings: { |
| 152 | type: type, |
| 153 | value: value |
| 154 | } |
| 155 | }, |
| 156 | dataType: 'json', |
| 157 | success: function(data) { |
| 158 | if (data.code == 200) { |
| 159 | $('.alert-sync').show(); |
| 160 | timeoutID = setTimeout( |
| 161 | function() { |
| 162 | $('.alert-sync').hide(); |
| 163 | }, 3000 |
| 164 | ); |
| 165 | } |
| 166 | } |
| 167 | }); |
| 168 | } |
| 169 | |
| 170 | $('.sync-spotify').on('change', function(e) { |
| 171 | prepareUpdate(); |
| 172 | updateSettings('sync_spotify', e.target.checked); |
| 173 | }) |
| 174 | $('.allowed-use-spotify-token').on('change', function(e) { |
| 175 | prepareUpdate(); |
| 176 | updateSettings('allowed_use_spotify_token', e.target.checked); |
| 177 | }) |
| 178 | $('.allowed-use-google-token').on('change', function(e) { |
| 179 | prepareUpdate(); |
| 180 | updateSettings('allowed_use_google_token', e.target.checked); |
| 181 | }); |
| 182 | </script> |