lots of changes

This commit is contained in:
Víctor Losada Hernández
2026-10-07 23:15:28 +02:00
parent 200517940e
commit f6614e1011
5 changed files with 47 additions and 34 deletions
@@ -62,13 +62,6 @@ const Account = createReactClass({
// Logged in // Logged in
if(global.account){ if(global.account){
return <div className='nav-section'> return <div className='nav-section'>
<Nav.item
className='account username'
color='orange'
icon='fas fa-user'
>
{global.account.username}
</Nav.item>
<Nav.item <Nav.item
href={`/user/${encodeURIComponent(global.account.username)}`} href={`/user/${encodeURIComponent(global.account.username)}`}
color='yellow' color='yellow'
+2 -1
View File
@@ -25,7 +25,7 @@ const Nav = {
</div>; </div>;
}, },
item : ({ icon, href, newTab, onClick, color, children, className, disabled, ...props })=>{ item : ({ icon, kbd,href, newTab, onClick, color, children, className, disabled, ...props })=>{
const classes = cx('navItem', color, className); const classes = cx('navItem', color, className);
if(disabled) { if(disabled) {
return <button className={classes} disabled>{children}{icon && <i className={icon}></i>}</button> return <button className={classes} disabled>{children}{icon && <i className={icon}></i>}</button>
@@ -39,6 +39,7 @@ const Nav = {
return <button {...props} className={classes} onClick={onClick} > return <button {...props} className={classes} onClick={onClick} >
{children} {children}
{icon && <i className={icon}></i>} {icon && <i className={icon}></i>}
{kbd && <kbd>{kbd}</kbd>}
</button>; </button>;
} }
}, },
+9 -7
View File
@@ -14,6 +14,9 @@ import Nav from './nav.jsx';
const Navbar = ({ account, brew, title, props }) => { const Navbar = ({ account, brew, title, props }) => {
const version = global.version || '0.0.0'; const version = global.version || '0.0.0';
const isMac = navigator.platform.toUpperCase().includes("MAC");
const mod = isMac ? "⌘" : "Ctrl";
const renderTitle = () => { const renderTitle = () => {
//if vault //if vault
const cleanTitle = title.replace(/^\/+|\/+$/g, ''); const cleanTitle = title.replace(/^\/+|\/+$/g, '');
@@ -59,13 +62,12 @@ const Navbar = ({ account, brew, title, props }) => {
</Dropdown> </Dropdown>
<Dropdown groupName={'Edit'} customTrigger={<>Edit</>} icon={null} key={'edit'}> <Dropdown groupName={'Edit'} customTrigger={<>Edit</>} icon={null} key={'edit'}>
<div className='nav-section'> <div className='nav-section'>
<li className='navItem'>Undo</li> <Nav.item kbd={mod + ' + z'}>Undo</Nav.item>
<li className='navItem'>Redo</li> <Nav.item kbd={mod + ' + Shift + z'}>Redo</Nav.item>
<li className='navItem'>Cut</li> <Nav.item kbd={mod + ' + x'}>cut</Nav.item>
<li className='navItem'>Copy</li> <Nav.item kbd={mod + ' + c'}>copy</Nav.item>
<li className='navItem'>Paste</li> <Nav.item kbd={mod + ' + v'}>paste</Nav.item>
<li className='navItem'>Find</li> <Nav.item kbd={mod + ' + f'}>Find / Replace</Nav.item>
<li className='navItem'>Find and Replace</li>
</div> </div>
</Dropdown> </Dropdown>
<Dropdown groupName={'Go'} customTrigger={<>Go</>} icon={null} key={'go'}> <Dropdown groupName={'Go'} customTrigger={<>Go</>} icon={null} key={'go'}>
+27 -9
View File
@@ -299,7 +299,7 @@
place-items: center; place-items: center;
height: 100%; height: 100%;
width: 100%; width: 100%;
padding: 5px; padding: 5px 10px;
} }
a { a {
color: inherit; color: inherit;
@@ -309,11 +309,32 @@
&:hover { &:hover {
background:#555; background:#555;
} }
&:has(> i, > kbd) {
display:flex;
gap:5px;
justify-content: space-between;
}
kbd {
font-size:.8em;
font-family: monospace;
color:#aaa;
background:#222;
padding:2px 5px;
border-radius:5px;
}
}
.navItem {
height:2em;
&.header {
justify-content: center;
}
} }
> ul { > ul {
display: flex; display: flex;
gap: 15px;
align-items: center; align-items: center;
height: 100%; height: 100%;
@@ -321,14 +342,11 @@
height: 100%; height: 100%;
text-wrap:nowrap; text-wrap:nowrap;
&:not(:only-child) { &:first-child :is(button, a) {
padding-left: 15px;
&:first-child {
padding-left: 10px;
}
&:last-child {
padding-right: 10px;
} }
&:last-child :is(button, a) {
padding-right: 15px;
} }
} }
} }
+9 -10
View File
@@ -143,13 +143,15 @@ const RecentItems = createReactClass({
// if(!this.state.showDropdown) return null; // if(!this.state.showDropdown) return null;
const makeItems = (brews)=>{ const makeItems = (brews)=>{
return _.map(brews, (brew, i)=>{ return <div className="nav-section">
return <a className='navItem' href={brew.url} key={`${brew.id}-${i}`} target='_blank' rel='noopener noreferrer' title={brew.title || '[ no title ]'}> {_.map(brews, (brew, i)=>{
<span className='title'>{brew.title || '[ no title ]'}</span> return <a className='navItem' href={brew.url} key={`${brew.id}-${i}`} target='_blank' rel='noopener noreferrer' title={brew.title || '[ no title ]'}>
<span className='time'>{Moment(brew.ts).fromNow()}</span> <span className='title'>{brew.title || '[ no title ]'}</span>
<div className='clear' title='Remove from Recents' onClick={(e)=>{this.removeItem(`${brew.url}`, e);}}><i className='fas fa-times'></i></div> <span className='time'>{Moment(brew.ts).fromNow()}</span>
</a>; <div className='clear' title='Remove from Recents' onClick={(e)=>{this.removeItem(`${brew.url}`, e);}}><i className='fas fa-times'></i></div>
}); </a>
})};
</div>
}; };
return <> return <>
@@ -166,9 +168,6 @@ const RecentItems = createReactClass({
render : function(){ render : function(){
return <div className='recent'> return <div className='recent'>
<Nav.item icon='fas fa-history' color='grey' >
{this.props.text}
</Nav.item>
{this.renderDropdown()} {this.renderDropdown()}
</div>; </div>;
} }