Skip to content

Commit

Permalink
prepare for mobile
Browse files Browse the repository at this point in the history
  • Loading branch information
diegogurpegui committed Dec 27, 2023
1 parent 6d8466d commit 11e8c2b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 7 deletions.
21 changes: 15 additions & 6 deletions src/options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,12 @@ import {
RelaysConfig
} from './types';
import * as Storage from './storage';
import { getPermissionsString, isHexadecimal, isValidRelayURL } from './common';
import {
getPermissionsString,
isHexadecimal,
isValidRelayURL,
truncatePublicKeys
} from './common';
import logotype from './assets/logo/logotype.png';
import AddCircleIcon from './assets/icons/add-circle-outline.svg';
import ArrowUpCircleIcon from './assets/icons/arrow-up-circle-outline.svg';
Expand Down Expand Up @@ -465,7 +470,11 @@ function Options() {
<option value={profilePubKey} key={profilePubKey}>
{profilePubKey == ''
? '(new profile)'
: nip19.npubEncode(profilePubKey)}
: truncatePublicKeys(
nip19.npubEncode(profilePubKey),
20,
20
)}
</option>
))}
</select>
Expand All @@ -477,22 +486,22 @@ function Options() {
onClick={handleNewProfileClick}
>
<AddCircleIcon />
New profile
New
</button>
<button onClick={handleExportProfileClick}>
<DownloadIcon />
Export profile
Export
</button>
<button onClick={handleImportProfileClick}>
<ArrowUpCircleIcon />
Import profile
Import
</button>
<button
onClick={handleDeleteProfileClick}
className="button button-danger"
>
<TrashIcon />
Delete profile
Delete
</button>
</div>
</section>
Expand Down
7 changes: 7 additions & 0 deletions src/storage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,13 @@ export async function updateProfiles(
[ConfigurationKeys.PROFILES]: profiles
});

// if there's only one profile, then set it as the active one
const activePrivateKey = await readActivePrivateKey();
if (!activePrivateKey && Object.keys(profiles).length == 1) {
const profilePubKey = Object.keys(profiles)[0];
await updateActivePrivateKey(profiles[profilePubKey].privateKey);
}

return profiles;
}
export async function addProfile(
Expand Down
11 changes: 10 additions & 1 deletion src/style.scss
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ $button-radius: 0.3em;
$font-family: 'Prompt', Arial, Helvetica, sans-serif;
$font-size: 12pt;

$responsive-break-sm: 40em; // Small devices such as large phones (640px and up)
$responsive-break-md: 48em; // Medium devices such as tablets (768px and up)
$responsive-break-lg: 64em; // Large devices such as laptops (1024px and up)
$responsive-break-xl: 80em; // Largest devices such as desktops (1280px and up)

// ****** Font ******
@font-face {
font-family: 'Prompt';
Expand Down Expand Up @@ -108,7 +113,6 @@ button,
justify-content: center;
border: 2px solid $color-primary;
background-color: $color-primary;
color: $color-primary-inv;
padding: 0.5em 0.7em;
text-align: center;
text-decoration: none;
Expand All @@ -117,6 +121,11 @@ button,
font-weight: 500;
cursor: pointer;

&,
* {
color: $color-primary-inv;
}

img,
svg {
display: inline-block;
Expand Down

0 comments on commit 11e8c2b

Please sign in to comment.