Skip to content
Merged
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
10 changes: 0 additions & 10 deletions app/lib/frontend/handlers/experimental.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,7 @@ import '../../shared/cookie_utils.dart';
typedef PublicFlag = ({String name, String description});

const _publicFlags = <PublicFlag>{
(name: 'dark', description: 'Dark mode'),
(name: 'search-completion', description: 'Completions for the search bar'),
(name: 'search-topics', description: 'Show matching topics when searching'),
(
name: 'download-counts-version-chart',
description: 'Show downloads counts version chart'
),
};

final _allFlags = <String>{
Expand Down Expand Up @@ -92,14 +86,10 @@ class ExperimentalFlags {
return params;
}

bool get isSearchCompletionEnabled => true;
bool get isSearchTopicsEnabled => isEnabled('search-topics');

bool get isDarkModeEnabled => true;
bool get isDarkModeDefault => isEnabled('dark-as-default');

bool get showDownloadCountsVersionChart => true;

String encodedAsCookie() => _enabled.join(':');

@override
Expand Down
4 changes: 1 addition & 3 deletions app/lib/frontend/templates/views/pkg/score_tab.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import 'package:pub_dev/shared/utils.dart';
import '../../../../scorecard/models.dart' hide ReportStatus;
import '../../../../shared/urls.dart' as urls;
import '../../../dom/dom.dart' as d;
import '../../../request_context.dart';
import '../../../static_files.dart';

/// Renders the score page content.
Expand Down Expand Up @@ -95,8 +94,7 @@ d.Node scoreTabNode({
d.text(' for details.'),
],
),
if (card.weeklyVersionDownloads != null &&
requestContext.experimentalFlags.showDownloadCountsVersionChart)
if (card.weeklyVersionDownloads != null)
_downloadsChart(card.weeklyVersionDownloads!),
]);
}
Expand Down
4 changes: 1 addition & 3 deletions app/lib/frontend/templates/views/shared/search_banner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import 'dart:convert';

import 'package:_pub_shared/data/completion.dart';
import 'package:pub_dev/frontend/request_context.dart';

import '../../../dom/dom.dart' as d;
import '../../../static_files.dart' show staticUrls;
Expand Down Expand Up @@ -36,8 +35,7 @@ d.Node searchBannerNode({
value: queryText,
attributes: {
'title': 'Search',
if (requestContext.experimentalFlags.isSearchCompletionEnabled)
'data-widget': 'completion',
'data-widget': 'completion',
'data-completion-src': '/api/search-input-completion-data',
'data-completion-class': 'search-completion',
},
Expand Down
23 changes: 7 additions & 16 deletions app/lib/frontend/templates/views/shared/site_header.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.

import 'package:pub_dev/frontend/request_context.dart';

import '../../../../account/models.dart' show SessionData;
import '../../../../shared/urls.dart' as urls;
import '../../../dom/dom.dart' as d;
Expand Down Expand Up @@ -116,24 +114,17 @@ d.Node siteHeaderNode({
_userBlock(userSession),
],
),
_themeSwitcher(),
// TODO: consider using Material symbols similar to dartdoc:
// <span id="dark-theme-button" class="material-symbols-outlined">dark_mode</span>
// <span id="light-theme-button" class="material-symbols-outlined">light_mode</span>
d.button(
classes: ['-pub-theme-toggle'],
ariaLabel: 'light/dark theme toggle',
),
],
);
}

d.Node _themeSwitcher() {
// <span id="dark-theme-button" class="material-symbols-outlined">dark_mode</span>
// <span id="light-theme-button" class="material-symbols-outlined">light_mode</span>
if (requestContext.experimentalFlags.isDarkModeEnabled) {
return d.fragment([
d.button(
classes: ['-pub-theme-toggle'], ariaLabel: 'light/dark theme toggle'),
]);
} else {
return d.fragment([]);
}
}

d.Node _userBlock(SessionData userSession) {
return d.div(
classes: ['nav-container', 'nav-profile-container', 'hoverable'],
Expand Down
2 changes: 1 addition & 1 deletion app/test/search/backend_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {
final descr = await searchBackend.fetchSdkLibraryDescriptions(
baseUri: index.baseUri,
libraryRelativeUrls: {
'dart:async': 'dart-async/dart-async-library.html',
'dart:async': 'dart-async/index.html',
},
);
expect(descr, {
Expand Down
4 changes: 0 additions & 4 deletions pkg/pub_integration/test/search_completition_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@ void main() {
final user = await fakeTestScenario.createAnonymousTestUser();

await user.withBrowserPage((page) async {
await page.gotoOrigin('/experimental?search-completion=1');

await page.gotoOrigin('/');
await page.keyboard.type('is:un');
await Future.delayed(Duration(milliseconds: 200));
Expand All @@ -59,8 +57,6 @@ void main() {
});

await user.withBrowserPage((page) async {
await page.gotoOrigin('/experimental?search-completion=1');

await page.gotoOrigin('/packages?q=abc');
await page.focus('input[name="q"]');
// go to the end of the input field and start typing
Expand Down
2 changes: 0 additions & 2 deletions pkg/pub_integration/test/theme_switch_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,6 @@ void main() {

// test keyboard navigation
await user.withBrowserPage((page) async {
await page.gotoOrigin('/experimental?dark=1');

Future<void> expectDarkTheme() async {
expect(await page.$OrNull('body.light-theme'), isNull);
expect(await page.$OrNull('body.dark-theme'), isNotNull);
Expand Down
Loading