Browse Source

Feature/change twitter to x (#2654)

* Change Twitter to X

* Update changelog
pull/2655/head
Thomas Kaul 1 year ago
committed by GitHub
parent
commit
1586cd3a59
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      CHANGELOG.md
  2. 25
      apps/api/src/app/benchmark/benchmark.service.ts
  3. 31
      apps/api/src/services/twitter-bot/twitter-bot.service.ts
  4. 7
      apps/client/src/app/app.component.html
  5. 8
      apps/client/src/app/pages/about/overview/about-overview-page.html
  6. 4
      apps/client/src/app/pages/faq/faq-page.html
  7. 1
      libs/common/src/lib/interfaces/benchmark-property.interface.ts

2
CHANGELOG.md

@ -15,6 +15,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- Improved the data source validation in the activities import - Improved the data source validation in the activities import
- Changed _Twitter_ to _𝕏_
- Improved selection in the twitter bot service
- Improved the language localization for German (`de`) - Improved the language localization for German (`de`)
- Upgraded `ng-extract-i18n-merge` from version `2.7.0` to `2.8.3` - Upgraded `ng-extract-i18n-merge` from version `2.7.0` to `2.8.3`
- Upgraded `prettier` from version `3.0.3` to `3.1.0` - Upgraded `prettier` from version `3.0.3` to `3.1.0`

25
apps/api/src/app/benchmark/benchmark.service.ts

@ -73,9 +73,10 @@ export class BenchmarkService {
return { trend50d: fiftyDayAverage, trend200d: twoHundredDayAverage }; return { trend50d: fiftyDayAverage, trend200d: twoHundredDayAverage };
} }
public async getBenchmarks({ useCache = true } = {}): Promise< public async getBenchmarks({
BenchmarkResponse['benchmarks'] enableSharing = false,
> { useCache = true
} = {}): Promise<BenchmarkResponse['benchmarks']> {
let benchmarks: BenchmarkResponse['benchmarks']; let benchmarks: BenchmarkResponse['benchmarks'];
if (useCache) { if (useCache) {
@ -90,7 +91,9 @@ export class BenchmarkService {
} catch {} } catch {}
} }
const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles(); const benchmarkAssetProfiles = await this.getBenchmarkAssetProfiles({
enableSharing
});
const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] = const promisesAllTimeHighs: Promise<{ date: Date; marketPrice: number }>[] =
[]; [];
@ -162,12 +165,22 @@ export class BenchmarkService {
return benchmarks; return benchmarks;
} }
public async getBenchmarkAssetProfiles(): Promise<Partial<SymbolProfile>[]> { public async getBenchmarkAssetProfiles({
enableSharing = false
} = {}): Promise<Partial<SymbolProfile>[]> {
const symbolProfileIds: string[] = ( const symbolProfileIds: string[] = (
((await this.propertyService.getByKey( ((await this.propertyService.getByKey(
PROPERTY_BENCHMARKS PROPERTY_BENCHMARKS
)) as BenchmarkProperty[]) ?? [] )) as BenchmarkProperty[]) ?? []
).map(({ symbolProfileId }) => { )
.filter((benchmark) => {
if (enableSharing) {
return benchmark.enableSharing;
}
return true;
})
.map(({ symbolProfileId }) => {
return symbolProfileId; return symbolProfileId;
}); });

31
apps/api/src/services/twitter-bot/twitter-bot.service.ts

@ -57,7 +57,7 @@ export class TwitterBotService {
symbolItem.marketPrice symbolItem.marketPrice
}/100)`; }/100)`;
const benchmarkListing = await this.getBenchmarkListing(3); const benchmarkListing = await this.getBenchmarkListing();
if (benchmarkListing?.length > 1) { if (benchmarkListing?.length > 1) {
status += '\n\n'; status += '\n\n';
@ -78,29 +78,22 @@ export class TwitterBotService {
} }
} }
private async getBenchmarkListing(aMax: number) { private async getBenchmarkListing() {
const benchmarks = await this.benchmarkService.getBenchmarks({ const benchmarks = await this.benchmarkService.getBenchmarks({
enableSharing: true,
useCache: false useCache: false
}); });
const benchmarkListing: string[] = []; return benchmarks
.map(({ marketCondition, name, performances }) => {
for (const [index, benchmark] of benchmarks.entries()) { return `${name} ${(
if (index > aMax - 1) { performances.allTimeHigh.performancePercent * 100
break;
}
benchmarkListing.push(
`${benchmark.name} ${(
benchmark.performances.allTimeHigh.performancePercent * 100
).toFixed(1)}%${ ).toFixed(1)}%${
benchmark.marketCondition !== 'NEUTRAL_MARKET' marketCondition !== 'NEUTRAL_MARKET'
? ' ' + resolveMarketCondition(benchmark.marketCondition).emoji ? ' ' + resolveMarketCondition(marketCondition).emoji
: '' : ''
}` }`;
); })
} .join('\n');
return benchmarkListing.join('\n');
} }
} }

7
apps/client/src/app/app.component.html

@ -127,8 +127,11 @@
class="align-items-baseline d-flex" class="align-items-baseline d-flex"
href="https://twitter.com/ghostfolio_" href="https://twitter.com/ghostfolio_"
target="_blank" target="_blank"
title="Follow Ghostfolio on Twitter" title="Follow Ghostfolio on X (formerly Twitter)"
>Twitter<ion-icon class="ml-1" name="open-outline"></ion-icon >X (formerly Twitter)<ion-icon
class="ml-1"
name="open-outline"
></ion-icon
></a> ></a>
</li> </li>
<li>&nbsp;</li> <li>&nbsp;</li>

8
apps/client/src/app/pages/about/overview/about-overview-page.html

@ -55,7 +55,7 @@
community, tweet to community, tweet to
<a <a
href="https://twitter.com/ghostfolio_" href="https://twitter.com/ghostfolio_"
title="Tweet to Ghostfolio on Twitter" title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a >@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'" ><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>, send an e-mail to >, send an e-mail to
@ -70,14 +70,14 @@
>GitHub</a >GitHub</a
>. >.
</p> </p>
<p class="text-center"> <p class="align-items-center d-flex justify-content-center">
<a <a
class="mx-2" class="mx-2"
href="https://twitter.com/ghostfolio_" href="https://twitter.com/ghostfolio_"
mat-icon-button mat-icon-button
title="Follow Ghostfolio on Twitter" title="Follow Ghostfolio on X (formerly Twitter)"
> >
<ion-icon name="logo-twitter"></ion-icon> <span class="line-height-1 text-center w-100">𝕏</span>
</a> </a>
<a <a
*ngIf="user?.subscription?.type === 'Premium'" *ngIf="user?.subscription?.type === 'Premium'"

4
apps/client/src/app/pages/faq/faq-page.html

@ -233,7 +233,7 @@
community, community,
<a <a
href="https://twitter.com/ghostfolio_" href="https://twitter.com/ghostfolio_"
title="Tweet to Ghostfolio on Twitter" title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a >@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'" ><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>, >,
@ -262,7 +262,7 @@
>community, tweet to >community, tweet to
<a <a
href="https://twitter.com/ghostfolio_" href="https://twitter.com/ghostfolio_"
title="Tweet to Ghostfolio on Twitter" title="Post to Ghostfolio on X (formerly Twitter)"
>@ghostfolio_</a >@ghostfolio_</a
><ng-container *ngIf="user?.subscription?.type === 'Premium'" ><ng-container *ngIf="user?.subscription?.type === 'Premium'"
>, send an e-mail to >, send an e-mail to

1
libs/common/src/lib/interfaces/benchmark-property.interface.ts

@ -1,3 +1,4 @@
export interface BenchmarkProperty { export interface BenchmarkProperty {
enableSharing?: boolean;
symbolProfileId: string; symbolProfileId: string;
} }

Loading…
Cancel
Save