feat: add sponsors
This commit is contained in:
parent
15a57899fd
commit
536b031655
|
@ -208,7 +208,7 @@ fragment UserPartsFull on User {
|
||||||
websiteUrl
|
websiteUrl
|
||||||
viewerCanFollow # TODO: remove in viewer query
|
viewerCanFollow # TODO: remove in viewer query
|
||||||
viewerIsFollowing
|
viewerIsFollowing
|
||||||
starredRepositories {
|
sponsors {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
followers {
|
followers {
|
||||||
|
@ -226,6 +226,9 @@ fragment UserPartsFull on User {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
organizations {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
repositories(
|
repositories(
|
||||||
first: 6
|
first: 6
|
||||||
ownerAffiliations: OWNER
|
ownerAffiliations: OWNER
|
||||||
|
@ -236,6 +239,12 @@ fragment UserPartsFull on User {
|
||||||
...RepoParts
|
...RepoParts
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
starredRepositories {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
|
gists {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
pinnedItems(first: 6) {
|
pinnedItems(first: 6) {
|
||||||
nodes {
|
nodes {
|
||||||
... on Repository {
|
... on Repository {
|
||||||
|
@ -265,6 +274,9 @@ query User($login: String!) {
|
||||||
email
|
email
|
||||||
websiteUrl
|
websiteUrl
|
||||||
createdAt
|
createdAt
|
||||||
|
sponsors {
|
||||||
|
totalCount
|
||||||
|
}
|
||||||
membersWithRole {
|
membersWithRole {
|
||||||
totalCount
|
totalCount
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,20 +32,9 @@ class _Repos extends StatelessWidget {
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return AntList(
|
return AntList(
|
||||||
header: Text(title),
|
header: Text(title),
|
||||||
|
mode: AntListMode.card,
|
||||||
children: [
|
children: [
|
||||||
for (final v in repos!)
|
for (final v in repos!) RepositoryItem.gql(v),
|
||||||
RepositoryItem.gh(
|
|
||||||
owner: v.owner.login,
|
|
||||||
avatarUrl: v.owner.avatarUrl,
|
|
||||||
name: v.name,
|
|
||||||
description: v.description,
|
|
||||||
starCount: v.stargazers.totalCount,
|
|
||||||
forkCount: v.forks.totalCount,
|
|
||||||
primaryLanguageName: v.primaryLanguage?.name,
|
|
||||||
primaryLanguageColor: v.primaryLanguage?.color,
|
|
||||||
isPrivate: v.isPrivate,
|
|
||||||
isFork: v.isFork,
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -60,7 +49,6 @@ class _User extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
final theme = Provider.of<ThemeModel>(context);
|
final theme = Provider.of<ThemeModel>(context);
|
||||||
final login = p.login;
|
|
||||||
|
|
||||||
return Column(
|
return Column(
|
||||||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||||
|
@ -75,28 +63,25 @@ class _User extends StatelessWidget {
|
||||||
rightWidgets: rightWidgets,
|
rightWidgets: rightWidgets,
|
||||||
),
|
),
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
Row(children: [
|
Row(
|
||||||
EntryItem(
|
children: [
|
||||||
count: p.repositories.totalCount,
|
EntryItem(
|
||||||
text: AppLocalizations.of(context)!.repositories,
|
count: p.sponsors.totalCount,
|
||||||
url: '/github/$login?tab=repositories',
|
text: 'Sponsors',
|
||||||
),
|
url: 'https://github.com/sponsors/${p.login}',
|
||||||
EntryItem(
|
),
|
||||||
count: p.starredRepositories.totalCount,
|
EntryItem(
|
||||||
text: AppLocalizations.of(context)!.stars,
|
count: p.followers.totalCount,
|
||||||
url: '/github/$login?tab=stars',
|
text: AppLocalizations.of(context)!.followers,
|
||||||
),
|
url: '/github/${p.login}?tab=followers',
|
||||||
EntryItem(
|
),
|
||||||
count: p.followers.totalCount,
|
EntryItem(
|
||||||
text: AppLocalizations.of(context)!.followers,
|
count: p.following.totalCount,
|
||||||
url: '/github/$login?tab=followers',
|
text: AppLocalizations.of(context)!.following,
|
||||||
),
|
url: '/github/${p.login}?tab=following',
|
||||||
EntryItem(
|
),
|
||||||
count: p.following.totalCount,
|
],
|
||||||
text: AppLocalizations.of(context)!.following,
|
),
|
||||||
url: '/github/$login?tab=following',
|
|
||||||
),
|
|
||||||
]),
|
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
ContributionWidget(
|
ContributionWidget(
|
||||||
weeks: [
|
weeks: [
|
||||||
|
@ -111,28 +96,8 @@ class _User extends StatelessWidget {
|
||||||
),
|
),
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
AntList(
|
AntList(
|
||||||
|
mode: AntListMode.card,
|
||||||
children: [
|
children: [
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.rss),
|
|
||||||
child: Text(AppLocalizations.of(context)!.events),
|
|
||||||
onClick: () {
|
|
||||||
context.push('/github/$login?tab=events');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.book),
|
|
||||||
child: Text(AppLocalizations.of(context)!.gists),
|
|
||||||
onClick: () {
|
|
||||||
context.push('/github/$login?tab=gists');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.home),
|
|
||||||
child: Text(AppLocalizations.of(context)!.organizations),
|
|
||||||
onClick: () {
|
|
||||||
context.push('/github/$login?tab=organizations');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (isNotNullOrEmpty(p.company))
|
if (isNotNullOrEmpty(p.company))
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.organization),
|
prefix: const Icon(Octicons.organization),
|
||||||
|
@ -176,6 +141,51 @@ class _User extends StatelessWidget {
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
|
AntList(
|
||||||
|
mode: AntListMode.card,
|
||||||
|
children: [
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.organization),
|
||||||
|
extra: Text(p.organizations.totalCount.toString()),
|
||||||
|
onClick: () {
|
||||||
|
context.push('/github/${p.login}?tab=organizations');
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.organizations),
|
||||||
|
),
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.repo),
|
||||||
|
extra: Text(p.repositories.totalCount.toString()),
|
||||||
|
onClick: () {
|
||||||
|
context.pushUrl('/github/${p.login}?tab=repositories');
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.repositories),
|
||||||
|
),
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.star),
|
||||||
|
extra: Text(p.starredRepositories.totalCount.toString()),
|
||||||
|
onClick: () {
|
||||||
|
context.pushUrl('/github/${p.login}?tab=stars');
|
||||||
|
},
|
||||||
|
child: Text(AppLocalizations.of(context)!.stars),
|
||||||
|
),
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.book),
|
||||||
|
extra: Text(p.gists.totalCount.toString()),
|
||||||
|
child: Text(AppLocalizations.of(context)!.gists),
|
||||||
|
onClick: () {
|
||||||
|
context.push('/github/${p.login}?tab=gists');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.rss),
|
||||||
|
child: Text(AppLocalizations.of(context)!.events),
|
||||||
|
onClick: () {
|
||||||
|
context.push('/github/${p.login}?tab=events');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
CommonStyle.verticalGap,
|
||||||
_Repos(
|
_Repos(
|
||||||
p.pinnedItems.nodes!.whereType<GRepoParts>(),
|
p.pinnedItems.nodes!.whereType<GRepoParts>(),
|
||||||
p.repositories.nodes,
|
p.repositories.nodes,
|
||||||
|
@ -203,20 +213,62 @@ class _Org extends StatelessWidget {
|
||||||
bio: p.description,
|
bio: p.description,
|
||||||
),
|
),
|
||||||
CommonStyle.border,
|
CommonStyle.border,
|
||||||
Row(children: [
|
Row(
|
||||||
EntryItem(
|
children: [
|
||||||
count: p.pinnableItems.totalCount,
|
EntryItem(
|
||||||
text: AppLocalizations.of(context)!.repositories,
|
count: p.sponsors.totalCount,
|
||||||
url: '/github/${p.login}?tab=repositories',
|
text: 'Sponsors',
|
||||||
),
|
url: 'https://github.com/sponsors/${p.login}',
|
||||||
EntryItem(
|
),
|
||||||
count: p.membersWithRole.totalCount,
|
EntryItem(
|
||||||
text: AppLocalizations.of(context)!.members,
|
count: p.membersWithRole.totalCount,
|
||||||
url: '/github/${p.login}?tab=people',
|
text: AppLocalizations.of(context)!.members,
|
||||||
),
|
url: '/github/${p.login}?tab=people',
|
||||||
|
),
|
||||||
|
],
|
||||||
|
),
|
||||||
|
AntList(mode: AntListMode.card, children: [
|
||||||
|
if (isNotNullOrEmpty(p.location))
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.location),
|
||||||
|
child: Text(p.location!),
|
||||||
|
onClick: () {
|
||||||
|
launchStringUrl(
|
||||||
|
'https://www.google.com/maps/place/${p.location!.replaceAll(RegExp(r'\s+'), '')}');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (isNotNullOrEmpty(p.email))
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.mail),
|
||||||
|
child: Text(p.email!),
|
||||||
|
onClick: () {
|
||||||
|
launchStringUrl('mailto:${p.email!}');
|
||||||
|
},
|
||||||
|
),
|
||||||
|
if (isNotNullOrEmpty(p.websiteUrl))
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.link),
|
||||||
|
child: Text(p.websiteUrl!),
|
||||||
|
onClick: () {
|
||||||
|
var url = p.websiteUrl!;
|
||||||
|
if (!url.startsWith('http')) {
|
||||||
|
url = 'http://$url';
|
||||||
|
}
|
||||||
|
launchStringUrl(url);
|
||||||
|
},
|
||||||
|
),
|
||||||
]),
|
]),
|
||||||
AntList(
|
AntList(
|
||||||
|
mode: AntListMode.card,
|
||||||
children: [
|
children: [
|
||||||
|
AntListItem(
|
||||||
|
prefix: const Icon(Octicons.repo),
|
||||||
|
extra: Text(p.pinnableItems.totalCount.toString()),
|
||||||
|
child: Text(AppLocalizations.of(context)!.repositories),
|
||||||
|
onClick: () {
|
||||||
|
context.pushUrl('/github/${p.login}?tab=repositories');
|
||||||
|
},
|
||||||
|
),
|
||||||
AntListItem(
|
AntListItem(
|
||||||
prefix: const Icon(Octicons.rss),
|
prefix: const Icon(Octicons.rss),
|
||||||
child: Text(AppLocalizations.of(context)!.events),
|
child: Text(AppLocalizations.of(context)!.events),
|
||||||
|
@ -224,35 +276,6 @@ class _Org extends StatelessWidget {
|
||||||
context.push('/github/${p.login}?tab=events');
|
context.push('/github/${p.login}?tab=events');
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
if (isNotNullOrEmpty(p.location))
|
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.location),
|
|
||||||
child: Text(p.location!),
|
|
||||||
onClick: () {
|
|
||||||
launchStringUrl(
|
|
||||||
'https://www.google.com/maps/place/${p.location!.replaceAll(RegExp(r'\s+'), '')}');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (isNotNullOrEmpty(p.email))
|
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.mail),
|
|
||||||
child: Text(p.email!),
|
|
||||||
onClick: () {
|
|
||||||
launchStringUrl('mailto:${p.email!}');
|
|
||||||
},
|
|
||||||
),
|
|
||||||
if (isNotNullOrEmpty(p.websiteUrl))
|
|
||||||
AntListItem(
|
|
||||||
prefix: const Icon(Octicons.link),
|
|
||||||
child: Text(p.websiteUrl!),
|
|
||||||
onClick: () {
|
|
||||||
var url = p.websiteUrl!;
|
|
||||||
if (!url.startsWith('http')) {
|
|
||||||
url = 'http://$url';
|
|
||||||
}
|
|
||||||
launchStringUrl(url);
|
|
||||||
},
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
CommonStyle.verticalGap,
|
CommonStyle.verticalGap,
|
||||||
|
|
|
@ -76,7 +76,7 @@ class GhOrgs extends StatelessWidget {
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return ListStatefulScaffold<GOrgParts, String?>(
|
return ListStatefulScaffold<GOrgParts, String?>(
|
||||||
title: const AppBarTitle('Members'),
|
title: const AppBarTitle('Organizations'),
|
||||||
fetch: (cursor) async {
|
fetch: (cursor) async {
|
||||||
final auth = context.read<AuthModel>();
|
final auth = context.read<AuthModel>();
|
||||||
final req = GOrgsReq((b) {
|
final req = GOrgsReq((b) {
|
||||||
|
|
|
@ -92,7 +92,7 @@ class RepositoryItem extends StatelessWidget {
|
||||||
avatarLink = '/github/$owner',
|
avatarLink = '/github/$owner',
|
||||||
url = '/github/$owner/$name';
|
url = '/github/$owner/$name';
|
||||||
|
|
||||||
factory RepositoryItem.gql(GRepoParts v, {required note}) {
|
factory RepositoryItem.gql(GRepoParts v, {String? note}) {
|
||||||
return RepositoryItem.gh(
|
return RepositoryItem.gh(
|
||||||
owner: v.owner.login,
|
owner: v.owner.login,
|
||||||
avatarUrl: v.owner.avatarUrl,
|
avatarUrl: v.owner.avatarUrl,
|
||||||
|
|
Loading…
Reference in New Issue