Skip to content
This repository was archived by the owner on Apr 13, 2024. It is now read-only.
Open
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions CHANGELOG.MD
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## unreleased

## [0.13.5] - 2020-09-02
### Added
- Hosting card gets real data from HPOS for hosted happs and local source chain count
- Hosting card gets real data from HPOS for aggregatee of hosted happ zome calls
Expand Down
2 changes: 0 additions & 2 deletions default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ in
src = gitignoreSource ./.;

nativeBuildInputs = [
holochain-rust
nodejs
pkgconfig
cairo
Expand Down Expand Up @@ -133,7 +132,6 @@ in
src = gitignoreSource ./.;

nativeBuildInputs = [
holochain-rust
nodejs
pkgconfig
cairo
Expand Down
12 changes: 5 additions & 7 deletions src/components/CopyAgentId/CopyAgentId.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,19 @@ import { presentAgentId } from 'utils'
export default function CopyAgentId ({
agent,
isMe,
hpAdmin,
className,
children
}) {
const { id: hash, nickname } = agent
const happName = hpAdmin ? 'HP Admin' : 'HoloFuel'

let messageText

const { id: hash, nickname } = agent

if (isMe) {
messageText = `Your ${happName} Agent ID has been copied!`
messageText = `Your HP Admin Agent ID has been copied!`
} else if (nickname) {
messageText = `${nickname}'s ${happName} Agent ID has been copied!`
messageText = `${nickname}'s HP Admin Agent ID has been copied!`
} else {
messageText = `Full Agent ID of ${presentAgentId(hash)} has been copied!`
messageText = `Full HP Admin Agent ID of ${presentAgentId(hash)} has been copied!`
}

return <CopyToClipboard copyContent={hash} messageText={messageText} className={className}>
Expand Down
6 changes: 3 additions & 3 deletions src/components/CopyAgentId/CopyAgentId.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ it('render CopyToClipboard with "Your" in message when isMe', () => {
}

const children = agent.nickname
const messageText = 'Your HoloFuel Agent ID has been copied!'
const messageText = 'Your HP Admin Agent ID has been copied!'

const props = {
agent,
Expand All @@ -41,7 +41,7 @@ it('render CopyToClipboard with nickname in message when nickname is available',
}

const children = agent.nickname
const messageText = "Perry's HoloFuel Agent ID has been copied!"
const messageText = "Perry's HP Admin Agent ID has been copied!"

const props = {
agent
Expand All @@ -65,7 +65,7 @@ it('render CopyToClipboard with last 6 of id in message when nickname is NOT ava
}

const children = agent.id
const messageText = `Full Agent ID of ${presentAgentId(agent.id)} has been copied!`
const messageText = `Full HP Admin Agent ID of ${presentAgentId(agent.id)} has been copied!`

const props = {
agent
Expand Down
2 changes: 1 addition & 1 deletion src/components/SideMenu/SideMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export function SideMenu ({
return <aside styleName={cx('drawer', { 'drawer--open': isOpen })}>
<div styleName='container'>
<header styleName='header'>
<CopyAgentId agent={{ id: currentUser.hostPubKey }} hpAdmin isMe>
<CopyAgentId agent={{ id: currentUser.hostPubKey }} isMe>
<HashAvatar avatarUrl={avatarUrl} seed={currentUser.hostPubKey} size={48} styleName='avatar' />
</CopyAgentId>
<h2 styleName='host-name'>
Expand Down
15 changes: 9 additions & 6 deletions src/holofuel/components/CopyAgentId/CopyAgentId.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,19 @@ export default function CopyAgentId ({
className,
children
}) {
const { id: hash, nickname } = agent

let messageText
const { nickname } = agent
let messageText, hash

if (isMe) {
({ id: hash } = agent)
messageText = 'Your HoloFuel Agent ID has been copied!'
} else if (nickname) {
messageText = `${nickname}'s HoloFuel Agent ID has been copied!`
} else {
messageText = `Full Agent ID of ${presentAgentId(hash)} has been copied!`
({ agentAddress: hash } = agent)
if (nickname) {
messageText = `${nickname}'s HoloFuel Agent ID has been copied!`
} else {
messageText = `Full Agent ID of ${presentAgentId(hash)} has been copied!`
}
}

return <CopyToClipboard copyContent={hash} messageText={messageText} className={className}>
Expand Down
12 changes: 6 additions & 6 deletions src/holofuel/components/CopyAgentId/CopyAgentId.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ it('render CopyToClipboard with "Your" in message when isMe', () => {

it('render CopyToClipboard with nickname in message when nickname is available', async () => {
const agent = {
id: 'HcSCIgoBpzRmvnvq538iqbu39h9whsr6agZa6c9WPh9xujkb4dXBydEPaikvc5r',
agentAddress: 'HcSCIgoBpzRmvnvq538iqbu39h9whsr6agZa6c9WPh9xujkb4dXBydEPaikvc5r',
nickname: 'Perry'
}

Expand All @@ -54,18 +54,18 @@ it('render CopyToClipboard with nickname in message when nickname is available',
expect(CopyToClipboard).toHaveBeenCalledWith(
expect.objectContaining({
children,
copyContent: agent.id,
copyContent: agent.agentAddress,
messageText
}), {})
})

it('render CopyToClipboard with last 6 of id in message when nickname is NOT available', async () => {
const agent = {
id: 'HcSCIgoBpzRmvnvq538iqbu39h9whsr6agZa6c9WPh9xujkb4dXBydEPaikvc5r'
agentAddress: 'HcSCIgoBpzRmvnvq538iqbu39h9whsr6agZa6c9WPh9xujkb4dXBydEPaikvc5r'
}

const children = agent.id
const messageText = `Full Agent ID of ${presentAgentId(agent.id)} has been copied!`
const children = agent.agentAddress
const messageText = `Full Agent ID of ${presentAgentId(agent.agentAddress)} has been copied!`

const props = {
agent
Expand All @@ -78,7 +78,7 @@ it('render CopyToClipboard with last 6 of id in message when nickname is NOT ava
expect(CopyToClipboard).toHaveBeenCalledWith(
expect.objectContaining({
children,
copyContent: agent.id,
copyContent: agent.agentAddress,
messageText
}), {})
})