You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/08/23 22:30:00 UTC

[GitHub] [beam] damondouglas commented on a diff in pull request #22794: [Tour of Beam]: Welcome Screen frontend layout

damondouglas commented on code in PR #22794:
URL: https://github.com/apache/beam/pull/22794#discussion_r953153188


##########
learning/tour-of-beam/frontend/README.md:
##########
@@ -0,0 +1,25 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+# Tour of Beam
+

Review Comment:
   May we add a README at: learning/tour-of-beam/README.md that explains the purpose of Tour of Beam to someone who has never heard of it?
   
   Then, assuming that this learning/tour-of-beam/README.md exists, may we add:
   
   ```markdown
   # Overview
   
   This folder holds code that supports the user interface for [Tour of Beam](../).
   
   # Requirements
   
   To develop, build and test code in this folder requires the following:
   
   - https://flutter.dev/
   
   ```



##########
learning/tour-of-beam/frontend/lib/pages/welcome/screen.dart:
##########
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+
+import '../../components/complexity.dart';
+import '../../components/page_container.dart';
+import '../../config/theme/colors_provider.dart';
+import '../../constants/assets.dart';
+import '../../constants/colors.dart';
+import '../../constants/sizes.dart';
+
+class WelcomeScreen extends StatelessWidget {
+  const WelcomeScreen();
+
+  @override
+  Widget build(BuildContext context) {
+    return PageContainer(
+      child: SingleChildScrollView(
+        child: Row(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: const [
+            Expanded(child: _SdkSelection()),
+            Expanded(child: _TourSummary()),
+          ],
+        ),
+      ),
+    );
+  }
+}
+
+class _SdkSelection extends StatelessWidget {
+  const _SdkSelection();
+
+  @override
+  Widget build(BuildContext context) {
+    return _SdkSelectionBody(
+      child: Column(
+        children: [
+          Padding(
+            padding: const EdgeInsets.fromLTRB(50, 60, 50, 20),
+            child: Column(
+              crossAxisAlignment: CrossAxisAlignment.start,
+              children: const [
+                _IntroText(),
+                SizedBox(height: TobSizes.size32),
+                _Buttons(),
+              ],
+            ),
+          ),
+          Image.asset(TobAssets.welcomeLaptop),
+        ],
+      ),
+    );
+  }
+}
+
+class _TourSummary extends StatelessWidget {
+  const _TourSummary();
+
+  @override
+  Widget build(BuildContext context) {
+    return Padding(
+      padding: const EdgeInsets.symmetric(
+        vertical: TobSizes.size20,
+        horizontal: 27,
+      ),
+      child: Column(
+        children: _modules
+            .map(
+              (module) => _Module(
+                title: module,
+                isLast: module == _modules.last,
+              ),
+            )
+            .toList(),
+      ),
+    );
+  }
+
+  static const List<String> _modules = [
+    'Core Transforms',
+    'Common Transforms',
+    'IO',
+    'Windowing',
+    'Triggers',
+  ];
+}
+
+class _SdkSelectionBody extends StatelessWidget {
+  final Widget child;
+  const _SdkSelectionBody({required this.child});
+
+  @override
+  Widget build(BuildContext context) {
+    return DecoratedBox(
+      decoration: BoxDecoration(
+        color: ThemeColors.of(context).background,
+        border: Border(
+          right: BorderSide(
+            color: ThemeColors.of(context).divider,
+          ),
+        ),
+      ),
+      child: child,
+    );
+  }
+}
+
+class _IntroText extends StatelessWidget {
+  const _IntroText();
+
+  @override
+  Widget build(BuildContext context) {
+    return Column(
+      crossAxisAlignment: CrossAxisAlignment.start,
+      children: [
+        Text(
+          'pages.home.title',
+          style: Theme.of(context).textTheme.displayMedium,
+        ).tr(),
+        Container(
+          margin: const EdgeInsets.symmetric(vertical: 32),
+          height: 2,
+          color: TobColors.grey2,
+          constraints: const BoxConstraints(maxWidth: 150),
+        ),
+        RichText(
+          text: TextSpan(
+            style: Theme.of(context).textTheme.bodyLarge,
+            children: [
+              TextSpan(
+                text: 'pages.home.ifSaveProgress'.tr(),
+              ),
+              TextSpan(
+                text: 'pages.home.signIn'.tr(),
+                style: Theme.of(context)
+                    .textTheme
+                    .bodyLarge!
+                    .copyWith(color: ThemeColors.of(context).primary),
+                recognizer: TapGestureRecognizer()
+                  ..onTap = () {
+                    // TODO(nausharipov): sign in
+                  },
+              ),
+              TextSpan(text: '\n\n${'pages.home.selectLanguage'.tr()}'),
+            ],
+          ),
+        ),
+      ],
+    );
+  }
+}
+
+class _Buttons extends StatelessWidget {
+  const _Buttons();
+
+  void _onSdkChanged(String value) {
+    // TODO(nausharipov): select the language
+  }
+
+  @override
+  Widget build(BuildContext context) {
+    return Wrap(
+      children: [
+        Wrap(
+          children: ['Java', 'Python', 'Go']
+              .map(
+                (e) => _SdkButton(
+                  value: e,
+                  groupValue: _sdk,
+                  onChanged: _onSdkChanged,
+                ),
+              )
+              .toList(),
+        ),
+        ElevatedButton(

Review Comment:
   On a wide screen, for me the "Start learning" button appeared on the right side of the "Java", "Python", and "Go" buttons.  Yet, when I made the width more narrow, the "Start learning" button positioned below.
   
   May we persist the "Start learning" below the language selection buttons?



##########
learning/tour-of-beam/frontend/assets/translations/en.yaml:
##########
@@ -0,0 +1,39 @@
+#  Licensed to the Apache Software Foundation (ASF) under one
+#  or more contributor license agreements.  See the NOTICE file
+#  distributed with this work for additional information
+#  regarding copyright ownership.  The ASF licenses this file
+#  to you under the Apache License, Version 2.0 (the
+#  "License"); you may not use this file except in compliance
+#  with the License.  You may obtain a copy of the License at
+#
+#  http://www.apache.org/licenses/LICENSE-2.0
+#
+#  Unless required by applicable law or agreed to in writing,
+#  software distributed under the License is distributed on an
+#  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+#  KIND, either express or implied.  See the License for the
+#  specific language governing permissions and limitations
+#  under the License.
+
+ui:
+  copyright: '© The Apache Software Foundation'
+  darkMode: 'Dark Mode'
+  lightMode: 'Light Mode'
+  privacyPolicy: 'Privacy Policy'
+  reportIssue: 'Report issue in Jira'

Review Comment:
   I think the Beam project uses GitHub issues now instead of Jira.



##########
learning/tour-of-beam/frontend/lib/components/complexity.dart:
##########
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'package:flutter/material.dart';
+
+import '../constants/colors.dart';
+import '../constants/sizes.dart';
+
+enum Complexity { basic, medium, advanced }
+
+class ComplexityWidget extends StatelessWidget {
+  final Complexity complexity;
+
+  const ComplexityWidget({required this.complexity});
+
+  @override
+  Widget build(BuildContext context) {
+    return Row(children: _dots[complexity]!);
+  }
+
+  static const Map<Complexity, List<Widget>> _dots = {
+    Complexity.basic: [_Dot.green, _Dot.grey, _Dot.grey],
+    Complexity.medium: [_Dot.orange, _Dot.orange, _Dot.grey],

Review Comment:
   Unless I was in dark mode, the two orange dots were not distinguishable from the grey.



##########
learning/tour-of-beam/frontend/lib/pages/welcome/screen.dart:
##########
@@ -0,0 +1,348 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+import 'package:easy_localization/easy_localization.dart';
+import 'package:flutter/gestures.dart';
+import 'package:flutter/material.dart';
+import 'package:flutter_svg/svg.dart';
+
+import '../../components/complexity.dart';
+import '../../components/page_container.dart';
+import '../../config/theme/colors_provider.dart';
+import '../../constants/assets.dart';
+import '../../constants/colors.dart';
+import '../../constants/sizes.dart';
+
+class WelcomeScreen extends StatelessWidget {
+  const WelcomeScreen();
+
+  @override
+  Widget build(BuildContext context) {
+    return PageContainer(
+      child: SingleChildScrollView(
+        child: Row(
+          crossAxisAlignment: CrossAxisAlignment.start,
+          children: const [
+            Expanded(child: _SdkSelection()),
+            Expanded(child: _TourSummary()),
+          ],
+        ),
+      ),
+    );
+  }
+}
+
+class _SdkSelection extends StatelessWidget {
+  const _SdkSelection();
+
+  @override
+  Widget build(BuildContext context) {
+    return _SdkSelectionBody(
+      child: Column(
+        children: [
+          Padding(
+            padding: const EdgeInsets.fromLTRB(50, 60, 50, 20),
+            child: Column(
+              crossAxisAlignment: CrossAxisAlignment.start,
+              children: const [
+                _IntroText(),
+                SizedBox(height: TobSizes.size32),
+                _Buttons(),
+              ],
+            ),
+          ),
+          Image.asset(TobAssets.welcomeLaptop),

Review Comment:
   May we consider removing this image?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org